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('msHeaderDefaultValuesDictGridController', function ($scope, PolicyAppService, modalService, $modal){
21 $( "#dialog" ).hide();
23 PolicyAppService.getData('getDictionary/get_MicroServiceHeaderDefaultsData').then(function (data) {
25 $scope.data = JSON.parse(j.data);
26 $scope.microServiceHeaderDefaultDatas = JSON.parse($scope.data.microServiceHeaderDefaultDatas);
29 PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataByName').then(function (data) {
31 $scope.data = JSON.parse(j.data);
32 $scope.microServiceModelsDictionaryDatas = JSON.parse($scope.data.microServiceModelsDictionaryDatas);
35 PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
37 $scope.data = JSON.parse(j.data);
38 $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
41 PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
43 $scope.data = JSON.parse(j.data);
44 $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
47 PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) {
49 $scope.data = JSON.parse(j.data);
50 $scope.priorityDatas = JSON.parse($scope.data.priorityDatas);
53 PolicyAppService.getData('get_LockDownData').then(function(data){
55 $scope.data = JSON.parse(j.data);
56 $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
57 if($scope.lockdowndata[0].lockdown == true){
58 $scope.msHeaderDefaultValuesDictionaryGrid.columnDefs[0].visible = false;
59 $scope.gridApi.grid.refresh();
61 $scope.msHeaderDefaultValuesDictionaryGrid.columnDefs[0].visible = true;
62 $scope.gridApi.grid.refresh();
66 $scope.msHeaderDefaultValuesDictionaryGrid = {
67 data : 'microServiceHeaderDefaultDatas',
68 enableFiltering: true,
70 field: 'id', enableFiltering: false, headerCellTemplate: '' +
71 '<button id=\'New\' ng-click="grid.appScope.createNewModelAttributeWindow()" class="btn btn-success">' + 'Create</button>',
73 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editModelHeaderDefaultsWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
74 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteModelAttribute(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
75 },{ field: 'modelName', displayName :'MicroService', sort: { direction: 'asc', priority: 0 }},
76 { field: 'guard', displayName :'Guard'}, { field: 'priority', displayName :'Priority'},{ field: 'riskType', displayName :'Risk Type'},{ field: 'riskLevel', displayName :'Risk Level'},{field: 'onapName' , displayName :'Onap Name' }
80 $scope.editModelAttribute = null;
81 $scope.createNewModelAttributeWindow = function(){
82 $scope.editModelAttribute = null;
83 var modalInstance = $modal.open({
84 backdrop: 'static', keyboard: false,
85 templateUrl : 'add_HeaderDefaultValues_popup.html',
86 controller: 'editMSHeaderDefaultValuesController',
88 message: function () {
90 microServiceAttributeDictionaryDatas: $scope.editModelAttribute
96 modalInstance.result.then(function(response){
97 $scope.microServiceHeaderDefaultDatas=response.microServiceHeaderDefaultDatas;
101 $scope.editModelHeaderDefaultsWindow = function(modelAttributeDictionaryData) {
102 $scope.editHeaderDefaults = modelAttributeDictionaryData;
103 var modalInstance = $modal.open({
104 backdrop: 'static', keyboard: false,
105 templateUrl : 'add_HeaderDefaultValues_popup.html',
106 controller: 'editMSHeaderDefaultValuesController',
108 message: function () {
110 modelAttributeDictionaryData: $scope.editHeaderDefaults
116 modalInstance.result.then(function(response){
117 $scope.modelAttributeDictionaryDataa = response.modelAttributeDictionaryDatas;
121 $scope.deleteModelAttribute = function(data) {
122 modalService.popupConfirmWin("Confirm","You are about to delete the Header Default Values : "+data.modelName+". Do you want to continue?",
124 var uuu = "deleteDictionary/ms_dictionary/remove_headerDefaults";
125 var postData={data: data};
130 contentType: 'application/json',
131 data: JSON.stringify(postData),
132 success : function(data){
133 $scope.$apply(function(){$scope.microServiceHeaderDefaultDatas=data.microServiceHeaderDefaultDatas;});
135 error : function(data){
136 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);