2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018, 2019 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' ,
21 function ($scope, $modalInstance, message, PolicyAppService, UserInfoServiceDS2, Notification){
22 if(message.modelAttributeDictionaryData==null)
23 $scope.label='Set Header Default Values'
25 $scope.label='Edit Header Default Values'
26 $scope.disableCd=true;
29 PolicyAppService.getData('getDictionary/get_MicroServiceHeaderDefaultsData').then(function (data) {
31 $scope.data = JSON.parse(j.data);
32 $scope.microServiceHeaderDefaultDatas = JSON.parse($scope.data.microServiceHeaderDefaultDatas);
35 PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataServiceVersion').then(function (data) {
37 $scope.data = JSON.parse(j.data);
38 $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas);
41 PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
43 $scope.data = JSON.parse(j.data);
44 $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
47 PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
49 $scope.data = JSON.parse(j.data);
50 $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
53 PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
55 $scope.data = JSON.parse(j.data);
56 $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
59 PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) {
61 $scope.data = JSON.parse(j.data);
62 $scope.priorityDatas = JSON.parse($scope.data.priorityDatas);
65 /*getting user info from session*/
67 UserInfoServiceDS2.getFunctionalMenuStaticDetailSession()
68 .then(function (response) {
69 userid = response.userid;
72 $scope.editHeaderDefaults = message.modelAttributeDictionaryData;
73 $scope.editModelAttribute1 = {microservice: []};
75 if(message.modelAttributeDictionaryData.groupList != null){
76 var splitValue = message.modelAttributeDictionaryData.groupList.split(",");
79 $scope.saveHeaderDefaults = function(editHeaderDefaultsData) {
80 var uuu = "saveDictionary/ms_dictionary/save_headerDefaults";
81 var postData={modelAttributeDictionaryData: editHeaderDefaultsData, userid: userid};
86 contentType: 'application/json',
87 data: JSON.stringify(postData),
88 success : function(data){
89 $scope.$apply(function(){
90 $scope.microServiceHeaderDefaultDatas=data.microServiceHeaderDefaultDatas;});
91 if($scope.microServiceAttributeDictionaryDatas == "Duplicate"){
92 Notification.error("Model Attribute Dictionary exists with Same Attribute Name.")
94 $modalInstance.close({microServiceHeaderDefaultDatas:$scope.microServiceHeaderDefaultDatas});
97 error : function(data){
98 Notification.error("Error while saving.");
104 $scope.close = function() {
105 $modalInstance.close();