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('msDCAEUUIDDictGridController', function ($scope, MSDictionaryService,modalService, $modal, PapUrlService){
24 $( "#dialog" ).hide();
27 PapUrlService.getPapUrl().then(function(data) {
29 papUrl = config.PAP_URL;
32 MSDictionaryService.getDCAEUUIDDictionaryData(papUrl).then(function (data) {
34 $scope.data = JSON.parse(j.data);
35 console.log($scope.data);
36 $scope.dcaeUUIDDictionaryDatas = JSON.parse($scope.data.dcaeUUIDDictionaryDatas);
37 console.log($scope.dcaeUUIDDictionaryDatas);
39 console.log("failed");
44 $scope.dcaeUUIDDictionaryGrid = {
45 data : 'dcaeUUIDDictionaryDatas',
46 enableFiltering: true,
48 field: 'id', enableFiltering: false, headerCellTemplate: '' +
49 '<button id=\'New\' ng-click="grid.appScope.createNewMSDCAEUUIDWindow()" class="btn btn-success">' + 'Create</button>',
51 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editMSDCAEUUIDWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
52 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSDCAEUUID(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
53 },{ field: 'name', displayName : 'Name'},
54 { field: 'description' }
58 $scope.editDCAEuuid = null;
59 $scope.createNewMSDCAEUUIDWindow = function(){
60 $scope.editDCAEuuid = null;
61 var modalInstance = $modal.open({
62 backdrop: 'static', keyboard: false,
63 templateUrl : 'add_DCAEuuid_popup.html',
64 controller: 'editDCAEuuidController',
66 message: function () {
68 dcaeUUIDDictionaryDatas: $scope.editDCAEuuid
74 modalInstance.result.then(function(response){
75 console.log('response', response);
76 $scope.dcaeUUIDDictionaryDatas=response.dcaeUUIDDictionaryDatas;
80 $scope.editMSDCAEUUIDWindow = function(dcaeUUIDDictionaryData) {
81 $scope.editDCAEuuid = dcaeUUIDDictionaryData;
82 var modalInstance = $modal.open({
83 backdrop: 'static', keyboard: false,
84 templateUrl : 'add_DCAEuuid_popup.html',
85 controller: 'editDCAEuuidController',
87 message: function () {
89 dcaeUUIDDictionaryData: $scope.editDCAEuuid
95 modalInstance.result.then(function(response){
96 console.log('response', response);
97 $scope.dcaeUUIDDictionaryDatas = response.dcaeUUIDDictionaryDatas;
101 $scope.deleteMSDCAEUUID = function(data) {
102 modalService.popupConfirmWin("Confirm","You are about to delete the DCAE UUID : "+data.name+". Do you want to continue?",
104 var uuu = papUrl + "/ecomp/ms_dictionary/remove_dcaeuuid.htm";
105 var postData={data: data};
110 contentType: 'application/json',
111 data: JSON.stringify(postData),
112 success : function(data){
113 $scope.$apply(function(){$scope.dcaeUUIDDictionaryDatas=data.dcaeUUIDDictionaryDatas;});
115 error : function(data){
117 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);