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('actionListDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){
24 $( "#dialog" ).hide();
27 PapUrlService.getPapUrl().then(function(data) {
29 papUrl = config.PAP_URL;
32 FWDictionaryService.getActionListDictionaryData(papUrl).then(function (data) {
34 $scope.data = JSON.parse(j.data);
35 console.log($scope.data);
36 $scope.actionListDictionaryDatas = JSON.parse($scope.data.actionListDictionaryDatas);
37 console.log($scope.actionListDictionaryDatas);
39 console.log("failed");
44 $scope.actionListDictionaryGrid = {
45 data : 'actionListDictionaryDatas',
46 enableFiltering: true,
47 exporterCsvFilename: 'ActionList.csv',
49 enableSelectAll: true,
51 field: 'id', enableFiltering: false, headerCellTemplate: '' +
52 '<button id=\'New\' ng-click="grid.appScope.createNewFWActionListWindow()" class="btn btn-success">' + 'Create</button>',
54 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWActionListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
55 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWActionList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
56 },{ field: 'actionName', displayName : 'Action Name'},
57 { field: 'description' }
59 exporterPdfDefaultStyle: {fontSize: 9},
60 exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
61 exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
62 exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
63 exporterPdfFooter: function ( currentPage, pageCount ) {
64 return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
66 exporterPdfCustomFormatter: function ( docDefinition ) {
67 docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
68 docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
71 exporterPdfOrientation: 'portrait',
72 exporterPdfPageSize: 'LETTER',
73 exporterPdfMaxGridWidth: 500,
74 exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
75 onRegisterApi: function(gridApi){
76 $scope.gridApi = gridApi;
80 $scope.editActionList = null;
81 $scope.createNewFWActionListWindow = function(){
82 $scope.editActionList = null;
83 var modalInstance = $modal.open({
84 backdrop: 'static', keyboard: false,
85 templateUrl : 'add_FWActionList_popup.html',
86 controller: 'editFWActionListController',
88 message: function () {
90 actionListDictionaryDatas: $scope.editActionList
96 modalInstance.result.then(function(response){
97 console.log('response', response);
98 $scope.actionListDictionaryDatas=response.actionListDictionaryDatas;
102 $scope.editFWActionListWindow = function(actionListDictionaryData) {
103 $scope.editActionList = actionListDictionaryData;
104 var modalInstance = $modal.open({
105 backdrop: 'static', keyboard: false,
106 templateUrl : 'add_FWActionList_popup.html',
107 controller: 'editFWActionListController',
109 message: function () {
111 actionListDictionaryData: $scope.editActionList
117 modalInstance.result.then(function(response){
118 console.log('response', response);
119 $scope.actionListDictionaryDatas = response.actionListDictionaryDatas;
123 $scope.deleteFWActionList = function(data) {
124 modalService.popupConfirmWin("Confirm","You are about to delete the Action List "+data.actionName+". Do you want to continue?",
126 var uuu = papUrl + "/ecomp/fw_dictionary/remove_ActionList.htm";
127 var postData={data: data};
132 contentType: 'application/json',
133 data: JSON.stringify(postData),
134 success : function(data){
135 $scope.$apply(function(){$scope.actionListDictionaryDatas=data.actionListDictionaryDatas;});
137 error : function(data){
139 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);