2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 app.controller('editMSHeaderDefaultValuesController' , function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){
21 if(message.modelAttributeDictionaryData==null)
22 $scope.label='Set Header Default Values'
24 $scope.label='Edit Header Default Values'
25 $scope.disableCd=true;
28 PolicyAppService.getData('getDictionary/get_MicroServiceHeaderDefaultsData').then(function (data) {
30 $scope.data = JSON.parse(j.data);
31 console.log($scope.data);
32 $scope.microServiceHeaderDefaultDatas = JSON.parse($scope.data.microServiceHeaderDefaultDatas);
33 console.log("microServiceHeaderDefaultDatas:" + $scope.microServiceHeaderDefaultDatas);
35 console.log("failed");
38 PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataServiceVersion').then(function (data) {
40 $scope.data = JSON.parse(j.data);
41 console.log($scope.data);
42 $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas);
43 console.log($scope.microServiceModelsDictionaryDatas);
45 console.log("failed");
48 PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
50 $scope.data = JSON.parse(j.data);
51 console.log("riskTypeDictionaryDatas = " + $scope.data);
52 $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
53 console.log($scope.riskTypeDictionaryDatas);
55 console.log("failed");
58 PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
60 $scope.data = JSON.parse(j.data);
61 console.log("riskTypeDictionaryDatas: " + $scope.data);
62 $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
63 console.log($scope.riskTypeDictionaryDatas);
65 console.log("failed");
68 PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
70 $scope.data = JSON.parse(j.data);
71 console.log($scope.data);
72 $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
73 console.log($scope.onapNameDictionaryDatas);
75 console.log("failed");
78 PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) {
80 $scope.data = JSON.parse(j.data);
81 console.log($scope.data);
82 $scope.priorityDatas = JSON.parse($scope.data.priorityDatas);
83 console.log($scope.priorityDatas);
85 console.log("failed");
88 /*getting user info from session*/
90 UserInfoServiceDS2.getFunctionalMenuStaticDetailSession()
91 .then(function (response) {
92 userid = response.userid;
95 $scope.editHeaderDefaults = message.modelAttributeDictionaryData;
96 $scope.editModelAttribute1 = {microservice: []};
98 if(message.modelAttributeDictionaryData.groupList != null){
99 var splitValue = message.modelAttributeDictionaryData.groupList.split(",");
100 console.log(splitValue);
103 $scope.saveHeaderDefaults = function(editHeaderDefaultsData) {
104 console.log("editHeaderDefaultsData :" + editHeaderDefaultsData);
105 var uuu = "saveDictionary/ms_dictionary/save_headerDefaults";
106 var postData={modelAttributeDictionaryData: editHeaderDefaultsData, userid: userid};
111 contentType: 'application/json',
112 data: JSON.stringify(postData),
113 success : function(data){
114 $scope.$apply(function(){
115 $scope.microServiceAttributeDictionaryDatas=data.microServiceHeaderDefaultDatas;});
116 if($scope.microServiceAttributeDictionaryDatas == "Duplicate"){
117 Notification.error("Model Attribute Dictionary exists with Same Attribute Name.")
119 console.log($scope.microServiceAttributeDictionaryDatas);
120 $modalInstance.close({microServiceAttributeDictionaryDatas:$scope.microServiceAttributeDictionaryDatas});
123 error : function(data){
124 alert("Error while saving.");
130 $scope.close = function() {
131 $modalInstance.close();