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('portListDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){
24 $( "#dialog" ).hide();
27 PapUrlService.getPapUrl().then(function(data) {
29 papUrl = config.PAP_URL;
32 FWDictionaryService.getPortListDictionaryData(papUrl).then(function (data) {
34 $scope.data = JSON.parse(j.data);
35 console.log($scope.data);
36 $scope.portListDictionaryDatas = JSON.parse($scope.data.portListDictionaryDatas);
37 console.log($scope.portListDictionaryDatas);
39 console.log("failed");
42 FWDictionaryService.getPortListDictionaryData(papUrl).then(function (data) {
44 $scope.data = JSON.parse(j.data);
45 console.log($scope.data);
46 $scope.portListDictionaryDatas = JSON.parse($scope.data.portListDictionaryDatas);
47 console.log($scope.portListDictionaryDatas);
49 console.log("failed");
53 $scope.portListDictionaryGrid = {
54 data : 'portListDictionaryDatas',
55 enableFiltering: true,
57 field: 'id', enableFiltering: false, headerCellTemplate: '' +
58 '<button id=\'New\' ng-click="grid.appScope.createNewFWPortListWindow()" class="btn btn-success">' + 'Create</button>',
60 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWPortListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
61 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWPortList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
62 },{ field: 'portName', displayName : 'Port Name'},
63 { field: 'description' }
67 $scope.editPortList = null;
68 $scope.createNewFWPortListWindow = function(){
69 $scope.editPortList = null;
70 var modalInstance = $modal.open({
71 backdrop: 'static', keyboard: false,
72 templateUrl : 'add_FWPortList_popup.html',
73 controller: 'editFWPortListController',
75 message: function () {
77 portListDictionaryDatas: $scope.editPortList
83 modalInstance.result.then(function(response){
84 console.log('response', response);
85 $scope.portListDictionaryDatas=response.portListDictionaryDatas;
89 $scope.editFWPortListWindow = function(portListDictionaryData) {
90 $scope.editPortList = portListDictionaryData;
91 var modalInstance = $modal.open({
92 backdrop: 'static', keyboard: false,
93 templateUrl : 'add_FWPortList_popup.html',
94 controller: 'editFWPortListController',
96 message: function () {
98 portListDictionaryData: $scope.editPortList
104 modalInstance.result.then(function(response){
105 console.log('response', response);
106 $scope.portListDictionaryDatas = response.portListDictionaryDatas;
110 $scope.deleteFWPortList = function(data) {
111 modalService.popupConfirmWin("Confirm","You are about to delete the Port List "+data.portName+". Do you want to continue?",
113 var uuu = papUrl + "/ecomp/fw_dictionary/remove_PortList.htm";
114 var postData={data: data};
119 contentType: 'application/json',
120 data: JSON.stringify(postData),
121 success : function(data){
122 $scope.$apply(function(){$scope.portListDictionaryDatas=data.portListDictionaryDatas;});
124 error : function(data){
126 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);