2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
23 app.controller('msConfigNameDictGridController', function ($scope, MSDictionaryService,modalService, $modal, PapUrlService){
24 $( "#dialog" ).hide();
27 PapUrlService.getPapUrl().then(function(data) {
29 papUrl = config.PAP_URL;
32 MSDictionaryService.getMSConfigNameDictionaryData(papUrl).then(function (data) {
34 $scope.data = JSON.parse(j.data);
35 console.log($scope.data);
36 $scope.microServiceCongigNameDictionaryDatas = JSON.parse($scope.data.microServiceCongigNameDictionaryDatas);
37 console.log($scope.microServiceCongigNameDictionaryDatas);
39 console.log("failed");
45 $scope.msConfigNameDictionaryGrid = {
46 data : 'microServiceCongigNameDictionaryDatas',
47 enableFiltering: true,
49 field: 'id', enableFiltering: false, headerCellTemplate: '' +
50 '<button id=\'New\' ng-click="grid.appScope.createNewMSConfigNameWindow()" class="btn btn-success">' + 'Create</button>',
52 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSConfigNameWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
53 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSConfigName(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
54 },{ field: 'name', displayName : 'Name'},
55 { field: 'descriptionValue', displayName : 'Description' }
59 $scope.editMSConfig = null;
60 $scope.createNewMSConfigNameWindow = function(){
61 $scope.editMSConfig = null;
62 var modalInstance = $modal.open({
63 backdrop: 'static', keyboard: false,
64 templateUrl : 'add_msConfigName_popup.html',
65 controller: 'editMSConfigController',
67 message: function () {
69 microServiceCongigNameDictionaryDatas: $scope.editMSConfig
75 modalInstance.result.then(function(response){
76 console.log('response', response);
77 $scope.microServiceCongigNameDictionaryDatas=response.microServiceCongigNameDictionaryDatas;
81 $scope.editMSConfigNameWindow = function(microServiceCongigNameDictionaryData) {
82 $scope.editMSConfig = microServiceCongigNameDictionaryData;
83 var modalInstance = $modal.open({
84 backdrop: 'static', keyboard: false,
85 templateUrl : 'add_msConfigName_popup.html',
86 controller: 'editMSConfigController',
88 message: function () {
90 microServiceCongigNameDictionaryData: $scope.editMSConfig
96 modalInstance.result.then(function(response){
97 console.log('response', response);
98 $scope.microServiceCongigNameDictionaryDatas = response.microServiceCongigNameDictionaryDatas;
102 $scope.deleteMSConfigName = function(data) {
103 modalService.popupConfirmWin("Confirm","You are about to delete the Micro Service Config Name "+data.name+". Do you want to continue?",
105 var uuu = papUrl + "/ecomp/ms_dictionary/remove_msConfigName.htm";
106 var postData={data: data};
111 contentType: 'application/json',
112 data: JSON.stringify(postData),
113 success : function(data){
114 $scope.$apply(function(){$scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;});
116 error : function(data){
118 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);