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 var editFWPrefixListController = function ($scope, $modalInstance, message, Notification, PapUrlService, UserInfoService, Notification){
24 $scope.validate = 'false';
25 if(message.prefixListDictionaryData==null)
26 $scope.label='Add PrefixList'
28 $scope.label='Edit PrefixList'
29 $scope.disableCd=true;
33 PapUrlService.getPapUrl().then(function(data) {
35 papUrl = config.PAP_URL;
39 /*getting user info from session*/
41 UserInfoService.getFunctionalMenuStaticDetailSession()
42 .then(function (response) {
43 loginId = response.userid;
46 $scope.editPrefixList = message.prefixListDictionaryData;
48 $scope.saveFWPrefixList = function(prefixListDictionaryData) {
49 if($scope.validate == 'true'){
50 var uuu = papUrl + "/ecomp/fw_dictionary/save_prefixList.htm";
51 var postData={prefixListDictionaryData: prefixListDictionaryData, loginId: loginId};
56 contentType: 'application/json',
57 data: JSON.stringify(postData),
58 success : function(data){
59 $scope.$apply(function(){
60 $scope.prefixListDictionaryDatas=data.prefixListDictionaryDatas;});
61 if($scope.prefixListDictionaryDatas == "Duplicate"){
62 Notification.error("FW PrefixList Dictionary exists with Same PrefixList Name.")
64 console.log($scope.prefixListDictionaryDatas);
65 $modalInstance.close({prefixListDictionaryDatas:$scope.prefixListDictionaryDatas});
68 error : function(data){
69 alert("Error while saving.");
73 Notification.error('Prefix List Validation is Not Successful');
78 $scope.validateFWPrefixList = function(prefixListDictionaryData) {
79 var uuu = papUrl + "/ecomp/fw_dictionary/validate_prefixList.htm";
80 var postData={prefixListDictionaryData: prefixListDictionaryData};
85 contentType: 'application/json',
86 data: JSON.stringify(postData),
87 success : function(data){
88 $scope.$apply(function(){
89 $scope.result=data.result;});
90 console.log($scope.result);
91 if($scope.result == 'error'){
92 Notification.error('IP not according to CIDR notation');
94 $scope.validate = 'true';
100 $scope.close = function() {
101 $modalInstance.close();