aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models
diff options
context:
space:
mode:
authoruj426b <uj426b@att.com>2019-11-01 14:42:28 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-11-04 15:35:55 +0000
commita61c10945456dde51397d354379257c7d0d01fb2 (patch)
treed3d27e67b08f0ec451a174aee32347bf33134b54 /POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models
parent46b5b531eada52e963f9ca196473a6c1bd8cbf37 (diff)
Fixed Sonar issues for Console Logs
Issue-ID: POLICY-2153 Change-Id: Id21a9dd4910ff0c831e49a1539f130ade1779577 Signed-off-by: utkarshJ <uj426b@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models')
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js22
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js205
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js1511
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js84
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js835
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js259
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/OptimizationPolicyController.js54
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policyManager.js561
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js330
9 files changed, 1784 insertions, 2077 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
index fe55bb22d..35fb3cb81 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
@@ -63,46 +63,29 @@ angular.module('abs').controller('brmsParamPolicyController',
PolicyAppService.getData('getDictionary/get_BRMSControllerDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.brmsControllerDatas = JSON.parse($scope.data.brmsControllerDictionaryDatas);
- console.log($scope.brmsControllerDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_BRMSDependencyDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.brmsDependencyDatas = JSON.parse($scope.data.brmsDependencyDictionaryDatas);
- console.log($scope.brmsDependencyDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_BRMSParamDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.brmsParamDictionaryDatas = JSON.parse($scope.data.brmsParamDictionaryDatas);
- console.log($scope.brmsParamDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
$scope.temp.policy.dynamicLayoutMap = {};
$scope.addDataToFields = function(ruleName){
- console.log(ruleName);
if(ruleName != null){
var uuu = "policyController/getBRMSTemplateData.htm";
var postData={policyData: ruleName};
@@ -116,7 +99,6 @@ angular.module('abs').controller('brmsParamPolicyController',
$scope.$apply(function(){
$scope.temp.policy.dynamicLayoutMap = data.policyData;
});
- console.log( $scope.temp.policy.dynamicLayoutMap);
},
error : function(data){
Notification.error("Error While Retriving the Template Layout Pattren.");
@@ -128,7 +110,6 @@ angular.module('abs').controller('brmsParamPolicyController',
$scope.showbrmsrule = true;
$scope.ShowRule = function(policy){
- console.log(policy);
var uuu = "policyController/ViewBRMSParamPolicyRule.htm";
var postData={policyData: policy};
$.ajax({
@@ -186,7 +167,6 @@ angular.module('abs').controller('brmsParamPolicyController',
Notification.error("Policy Already Exists with Same Name in Scope.");
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Error Occured while saving Policy.");
@@ -196,7 +176,6 @@ angular.module('abs').controller('brmsParamPolicyController',
};
$scope.validatePolicy = function(policy){
- console.log(policy);
document.getElementById("validate").innerHTML = "";
var uuu = "policyController/validate_policy.htm";
var postData={policyData: policy};
@@ -230,7 +209,6 @@ angular.module('abs').controller('brmsParamPolicyController',
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Validation Failed.");
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
index 3e75e05a9..695cb423d 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
@@ -17,7 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
+angular.module('abs').controller('brmsRawPolicyController',
+ ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification',
+ function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
$("#dialog").hide();
$scope.policyNavigator;
@@ -25,18 +27,18 @@ angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window'
$scope.refreshCheck = false;
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
- $scope.temp.policy = {
- policyType : "Config",
- configPolicyType : "BRMS_Raw"
- }
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "BRMS_Raw"
+ }
}
$scope.refresh = function(){
- if($scope.refreshCheck){
- $scope.policyNavigator.refresh();
- }
- $scope.modal('createNewPolicy', true);
- $scope.temp.policy = "";
+ if($scope.refreshCheck){
+ $scope.policyNavigator.refresh();
+ }
+ $scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
@@ -44,127 +46,112 @@ angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window'
};
$('#ttlDate').datepicker({
- dateFormat: 'dd/mm/yy',
- changeMonth: true,
- changeYear: true,
- onSelect: function(date) {
- angular.element($('#ttlDate')).triggerHandler('input');
- }
+ dateFormat: 'dd/mm/yy',
+ changeMonth: true,
+ changeYear: true,
+ onSelect: function(date) {
+ angular.element($('#ttlDate')).triggerHandler('input');
+ }
});
PolicyAppService.getData('getDictionary/get_BRMSControllerDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.brmsControllerDatas = JSON.parse($scope.data.brmsControllerDictionaryDatas);
- console.log($scope.brmsControllerDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.brmsControllerDatas = JSON.parse($scope.data.brmsControllerDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_BRMSDependencyDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.brmsDependencyDatas = JSON.parse($scope.data.brmsDependencyDictionaryDatas);
- console.log($scope.brmsDependencyDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.brmsDependencyDatas = JSON.parse($scope.data.brmsDependencyDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
});
$scope.saveBrmsRawPolicy = function(policy){
- if(policy.itemContent != undefined){
- $scope.refreshCheck = true;
- $scope.policyNavigator = policy.itemContent;
- policy.itemContent = "";
- }
+ if(policy.itemContent != undefined){
+ $scope.refreshCheck = true;
+ $scope.policyNavigator = policy.itemContent;
+ policy.itemContent = "";
+ }
$scope.savebutton = false;
var uuu = "policycreation/save_policy";
- var postData={policyData: policy};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.data=data.policyData;
- if($scope.data == 'success'){
- $scope.temp.policy.readOnly = 'true';
- Notification.success("Policy Saved Successfully.");
- }else if ($scope.data == 'PolicyExists'){
- $scope.savebutton = true;
- Notification.error("Policy Already Exists with Same Name in Scope.");
- }
- });
- console.log($scope.data);
- },
- error : function(data){
- Notification.error("Error Occured while saving Policy.");
- $scope.savebutton = true;
- }
- });
+ var postData={policyData: policy};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.data=data.policyData;
+ if($scope.data == 'success'){
+ $scope.temp.policy.readOnly = 'true';
+ Notification.success("Policy Saved Successfully.");
+ }else if ($scope.data == 'PolicyExists'){
+ $scope.savebutton = true;
+ Notification.error("Policy Already Exists with Same Name in Scope.");
+ }
+ });
+ },
+ error : function(data){
+ Notification.error("Error Occured while saving Policy.");
+ $scope.savebutton = true;
+ }
+ });
};
$scope.validatePolicy = function(policy){
- console.log(policy);
- document.getElementById("validate").innerHTML = "";
+ document.getElementById("validate").innerHTML = "";
var uuu = "policyController/validate_policy.htm";
- var postData={policyData: policy};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.validateData = data.data.replace(/\"/g, "");
- $scope.data=data.data.substring(1,8);
- var size = data.data.length;
- if($scope.data == 'success'){
- Notification.success("Validation Success.");
- $scope.savebutton = false;
- if (size > 18){
- var displayWarning = data.data.substring(19,size);
- document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "skyblue";
- }
- }else{
- Notification.error("Validation Failed.");
- document.getElementById("validate").innerHTML = $scope.validateData;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "red";
- $scope.savebutton = true;
- }
-
- });
- console.log($scope.data);
- },
- error : function(data){
- Notification.error("Validation Failed.");
- }
- });
+ var postData={policyData: policy};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.validateData = data.data.replace(/\"/g, "");
+ $scope.data=data.data.substring(1,8);
+ var size = data.data.length;
+ if($scope.data == 'success'){
+ Notification.success("Validation Success.");
+ $scope.savebutton = false;
+ if (size > 18){
+ var displayWarning = data.data.substring(19,size);
+ document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "skyblue";
+ }
+ }else{
+ Notification.error("Validation Failed.");
+ document.getElementById("validate").innerHTML = $scope.validateData;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "red";
+ $scope.savebutton = true;
+ }
+
+ });
+ },
+ error : function(data){
+ Notification.error("Validation Failed.");
+ }
+ });
};
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
- $scope.temp.policy.attributes = [];
+ $scope.temp.policy.attributes = [];
}else{
- if($scope.temp.policy.attributes.length == 0){
- $scope.temp.policy.attributes = [];
- }
+ if($scope.temp.policy.attributes.length == 0){
+ $scope.temp.policy.attributes = [];
+ }
}
$scope.attributeDatas = [{"attributes" : $scope.temp.policy.attributes}];
$scope.addNewChoice = function() {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
index 7bd04c97a..a8368a05e 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
@@ -17,26 +17,28 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-angular.module("abs").controller('clFaultController', ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification){
- $("#dialog").hide();
+angular.module("abs").controller('clFaultController',
+ ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification',
+ function($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification){
+ $("#dialog").hide();
- $scope.policyNavigator;
- $scope.savebutton = true;
- $scope.refreshCheck = false;
+ $scope.policyNavigator;
+ $scope.savebutton = true;
+ $scope.refreshCheck = false;
- if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
- $scope.temp.policy = {
- policyType : "Config",
- configPolicyType : "ClosedLoop_Fault"
- }
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "ClosedLoop_Fault"
+ }
}
$scope.refresh = function(){
- if($scope.refreshCheck){
- $scope.policyNavigator.refresh();
- }
- $scope.modal('createNewPolicy', true);
- $scope.temp.policy = "";
+ if($scope.refreshCheck){
+ $scope.policyNavigator.refresh();
+ }
+ $scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
@@ -44,780 +46,749 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol
};
$('#ttlDate').datepicker({
- dateFormat: 'dd/mm/yy',
- changeMonth: true,
- changeYear: true,
- onSelect: function(date) {
- angular.element($('#ttlDate')).triggerHandler('input');
- }
+ dateFormat: 'dd/mm/yy',
+ changeMonth: true,
+ changeYear: true,
+ onSelect: function(date) {
+ angular.element($('#ttlDate')).triggerHandler('input');
+ }
});
-
- if($scope.temp.policy.triggerTrapSignatures == undefined){
- $scope.temp.policy.triggerTrapSignatures = [];
- $scope.temp.policy.triggerfaultSignatures = [];
- }
- var trapCollection = [];
- var faultCollection = [];
- if($scope.varbindDictionaryDatas == undefined){
- $scope.varbindDictionaryDatas = [];
- }
-
- $scope.init = function(data){
- if(data != undefined && $scope.temp.policy.triggerTrapSignatures.length == 0){
- $scope.jsonData = data;
- if($scope.jsonData.triggerSignaturesUsedForUI != null){
- if($scope.jsonData.triggerSignaturesUsedForUI.signatures != null){
- $scope.temp.policy.triggerTrapSignatures = {Trap1 : [], Trap2 : [], Trap3 : [], Trap4 : [], Trap5 : [], Trap6 : []};
- var splitTraps = $scope.jsonData.triggerSignaturesUsedForUI.signatures.split("#!?!");
- if(splitTraps.length > 1){
- $scope.triggerdisabled = false;
- var indexId = "Trap1";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+1});
- var splitTrap1 = splitTraps[0];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap1"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 2){
- var indexId = "Trap2";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+2});
- var splitTrap1 = splitTraps[1];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] == ''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap2"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 3){
- var indexId = "Trap3";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+3});
- var splitTrap1 = splitTraps[2];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap3"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 4){
- var indexId = "Trap4";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+4});
- var splitTrap1 = splitTraps[3];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap4"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 5){
- var indexId = "Trap5";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+5});
- var splitTrap1 = splitTraps[4];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap5"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 6){
- var indexId = "Trap6";
- trapCollection.push(indexId);
- $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+6});
- var splitTrap1 = splitTraps[5];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerTrapSignatures["Trap6"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if($scope.jsonData.triggerSignaturesUsedForUI.connectSignatures != null){
- var splitConnectTraps = $scope.jsonData.triggerSignaturesUsedForUI.connectSignatures.split("#!?!");
- for(i=0; i < splitConnectTraps.length; i++){
- if(splitConnectTraps[i] != ""){
- var newConnectTrapItemNo = i+1;
- var connects = splitConnectTraps[i].split("@!");
- if(connects[0] == 'NOT' || connects[0] ==''){
- var notBox = connects[0];
- var connectTrap1 = connects[1];
- var trapCount1 = connects[2];
- var operatorBox = connects[3];
- var connectTrap2 = connects[4];
- var trapCount2 = connects[5];
- }else{
- var notBox = '';
- var connectTrap1 = connects[0];
- var trapCount1 = connects[1];
- var operatorBox = connects[2];
- var connectTrap2 = connects[3];
- var trapCount2 = connects[4];
- }
- $scope.temp.policy.connecttriggerSignatures.push({'id':'C'+newConnectTrapItemNo,'notBox' : notBox , 'connectTrap1': connectTrap1,'trapCount1' : trapCount1,
- 'operatorBox': operatorBox, 'connectTrap2': connectTrap2,'trapCount2' : trapCount2});
- }
- }
- }
- }
- }
- if($scope.jsonData.verificationSignaturesUsedForUI != null){
- if($scope.jsonData.verificationSignaturesUsedForUI.signatures != null){
- $scope.temp.policy.triggerfaultSignatures = {Fault1 : [], Fault2 : [], Fault3 : [], Fault4 : [], Fault5 : [], Fault6 : []};
- var splitTraps = $scope.jsonData.verificationSignaturesUsedForUI.signatures.split("#!?!");
- if(splitTraps.length > 1){
- $scope.verificationdisabled = false;
- var indexId = "Fault1";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+1});
- var splitTrap1 = splitTraps[0];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault1"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 2){
- var indexId = "Fault2";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+2});
- var splitTrap1 = splitTraps[1];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] == ''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault2"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 3){
- var indexId = "Fault3";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+3});
- var splitTrap1 = splitTraps[2];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault3"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 4){
- var indexId = "Fault4";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+4});
- var splitTrap1 = splitTraps[3];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault4"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 5){
- var indexId = "Fault5";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+5});
- var splitTrap1 = splitTraps[4];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault5"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
- if(splitTraps.length > 6){
- var indexId = "Fault6";
- faultCollection.push(indexId);
- $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+6});
- var splitTrap1 = splitTraps[5];
- var splitEachTrap = splitTrap1.split("#!");
- for(i = 0 ; i < splitEachTrap.length; i++){
- var splitEachRow = splitEachTrap[i].split("@!");
- var count = i +1;
- if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
- var notBox = splitEachRow[0];
- var trigger1 = splitEachRow[1];
- var operatorBox = splitEachRow[2];
- var trigger2 = splitEachRow[3];
- }else{
- var notBox = '';
- var trigger1 = splitEachRow[0];
- var operatorBox = splitEachRow[1];
- var trigger2 = splitEachRow[2];
- }
- $scope.varbindDictionaryDatas.push('A'+count);
- $scope.temp.policy.triggerfaultSignatures["Fault6"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
- }
- }
+
+ if($scope.temp.policy.triggerTrapSignatures == undefined){
+ $scope.temp.policy.triggerTrapSignatures = [];
+ $scope.temp.policy.triggerfaultSignatures = [];
+ }
+ var trapCollection = [];
+ var faultCollection = [];
+ if($scope.varbindDictionaryDatas == undefined){
+ $scope.varbindDictionaryDatas = [];
+ }
+
+ $scope.init = function(data){
+ if(data != undefined && $scope.temp.policy.triggerTrapSignatures.length == 0){
+ $scope.jsonData = data;
+ if($scope.jsonData.triggerSignaturesUsedForUI != null){
+ if($scope.jsonData.triggerSignaturesUsedForUI.signatures != null){
+ $scope.temp.policy.triggerTrapSignatures = {Trap1 : [], Trap2 : [], Trap3 : [], Trap4 : [], Trap5 : [], Trap6 : []};
+ var splitTraps = $scope.jsonData.triggerSignaturesUsedForUI.signatures.split("#!?!");
+ if(splitTraps.length > 1){
+ $scope.triggerdisabled = false;
+ var indexId = "Trap1";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+1});
+ var splitTrap1 = splitTraps[0];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap1"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 2){
+ var indexId = "Trap2";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+2});
+ var splitTrap1 = splitTraps[1];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] == ''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap2"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 3){
+ var indexId = "Trap3";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+3});
+ var splitTrap1 = splitTraps[2];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap3"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 4){
+ var indexId = "Trap4";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+4});
+ var splitTrap1 = splitTraps[3];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap4"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 5){
+ var indexId = "Trap5";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+5});
+ var splitTrap1 = splitTraps[4];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap5"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 6){
+ var indexId = "Trap6";
+ trapCollection.push(indexId);
+ $scope.temp.policy.triggerTrapSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+6});
+ var splitTrap1 = splitTraps[5];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerTrapSignatures["Trap6"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if($scope.jsonData.triggerSignaturesUsedForUI.connectSignatures != null){
+ var splitConnectTraps = $scope.jsonData.triggerSignaturesUsedForUI.connectSignatures.split("#!?!");
+ for(i=0; i < splitConnectTraps.length; i++){
+ if(splitConnectTraps[i] != ""){
+ var newConnectTrapItemNo = i+1;
+ var connects = splitConnectTraps[i].split("@!");
+ if(connects[0] == 'NOT' || connects[0] ==''){
+ var notBox = connects[0];
+ var connectTrap1 = connects[1];
+ var trapCount1 = connects[2];
+ var operatorBox = connects[3];
+ var connectTrap2 = connects[4];
+ var trapCount2 = connects[5];
+ }else{
+ var notBox = '';
+ var connectTrap1 = connects[0];
+ var trapCount1 = connects[1];
+ var operatorBox = connects[2];
+ var connectTrap2 = connects[3];
+ var trapCount2 = connects[4];
+ }
+ $scope.temp.policy.connecttriggerSignatures.push({'id':'C'+newConnectTrapItemNo,'notBox' : notBox , 'connectTrap1': connectTrap1,'trapCount1' : trapCount1,
+ 'operatorBox': operatorBox, 'connectTrap2': connectTrap2,'trapCount2' : trapCount2});
+ }
+ }
+ }
+ }
+ }
+ if($scope.jsonData.verificationSignaturesUsedForUI != null){
+ if($scope.jsonData.verificationSignaturesUsedForUI.signatures != null){
+ $scope.temp.policy.triggerfaultSignatures = {Fault1 : [], Fault2 : [], Fault3 : [], Fault4 : [], Fault5 : [], Fault6 : []};
+ var splitTraps = $scope.jsonData.verificationSignaturesUsedForUI.signatures.split("#!?!");
+ if(splitTraps.length > 1){
+ $scope.verificationdisabled = false;
+ var indexId = "Fault1";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+1});
+ var splitTrap1 = splitTraps[0];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault1"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 2){
+ var indexId = "Fault2";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+2});
+ var splitTrap1 = splitTraps[1];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] == ''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault2"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 3){
+ var indexId = "Fault3";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+3});
+ var splitTrap1 = splitTraps[2];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault3"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 4){
+ var indexId = "Fault4";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+4});
+ var splitTrap1 = splitTraps[3];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault4"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 5){
+ var indexId = "Fault5";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+5});
+ var splitTrap1 = splitTraps[4];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault5"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
+ if(splitTraps.length > 6){
+ var indexId = "Fault6";
+ faultCollection.push(indexId);
+ $scope.temp.policy.triggerfaultSignatures[indexId.replace(/['"]+/g, '')] = [];
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+6});
+ var splitTrap1 = splitTraps[5];
+ var splitEachTrap = splitTrap1.split("#!");
+ for(i = 0 ; i < splitEachTrap.length; i++){
+ var splitEachRow = splitEachTrap[i].split("@!");
+ var count = i +1;
+ if(splitEachRow[0] == 'NOT' || splitEachRow[0] ==''){
+ var notBox = splitEachRow[0];
+ var trigger1 = splitEachRow[1];
+ var operatorBox = splitEachRow[2];
+ var trigger2 = splitEachRow[3];
+ }else{
+ var notBox = '';
+ var trigger1 = splitEachRow[0];
+ var operatorBox = splitEachRow[1];
+ var trigger2 = splitEachRow[2];
+ }
+ $scope.varbindDictionaryDatas.push('A'+count);
+ $scope.temp.policy.triggerfaultSignatures["Fault6"].push({'id':'A'+count, 'notBox' : notBox , 'trigger1': trigger1 , 'operatorBox' : operatorBox, 'trigger2': trigger2});
+ }
+ }
- if($scope.jsonData.verificationSignaturesUsedForUI.connectSignatures != null){
- var splitConnectTraps = $scope.jsonData.verificationSignaturesUsedForUI.connectSignatures.split("#!?!");
- for(i=0; i < splitConnectTraps.length; i++){
- if(splitConnectTraps[i] != ""){
- var newConnectTrapItemNo = i+1;
- var connects = splitConnectTraps[i].split("@!");
- if(connects[0] == 'NOT' || connects[0] ==''){
- var notBox = connects[0];
- var connectTrap1 = connects[1];
- var trapCount1 = connects[2];
- var operatorBox = connects[3];
- var connectTrap2 = connects[4];
- var trapCount2 = connects[5];
- }else{
- var notBox = '';
- var connectTrap1 = connects[0];
- var trapCount1 = connects[1];
- var operatorBox = connects[2];
- var connectTrap2 = connects[3];
- var trapCount2 = connects[4];
- }
- $scope.temp.policy.connectVerificationSignatures.push({'id':'C'+newConnectTrapItemNo,'notBox' : notBox , 'connectTrap1': connectTrap1,'trapCount1' : trapCount1,
- 'operatorBox': operatorBox, 'connectTrap2': connectTrap2,'trapCount2' : trapCount2});
- }
- }
- }
- }
- }
- }
+ if($scope.jsonData.verificationSignaturesUsedForUI.connectSignatures != null){
+ var splitConnectTraps = $scope.jsonData.verificationSignaturesUsedForUI.connectSignatures.split("#!?!");
+ for(i=0; i < splitConnectTraps.length; i++){
+ if(splitConnectTraps[i] != ""){
+ var newConnectTrapItemNo = i+1;
+ var connects = splitConnectTraps[i].split("@!");
+ if(connects[0] == 'NOT' || connects[0] ==''){
+ var notBox = connects[0];
+ var connectTrap1 = connects[1];
+ var trapCount1 = connects[2];
+ var operatorBox = connects[3];
+ var connectTrap2 = connects[4];
+ var trapCount2 = connects[5];
+ }else{
+ var notBox = '';
+ var connectTrap1 = connects[0];
+ var trapCount1 = connects[1];
+ var operatorBox = connects[2];
+ var connectTrap2 = connects[3];
+ var trapCount2 = connects[4];
+ }
+ $scope.temp.policy.connectVerificationSignatures.push({'id':'C'+newConnectTrapItemNo,'notBox' : notBox , 'connectTrap1': connectTrap1,'trapCount1' : trapCount1,
+ 'operatorBox': operatorBox, 'connectTrap2': connectTrap2,'trapCount2' : trapCount2});
+ }
+ }
+ }
+ }
+ }
+ }
- };
+ };
- if($scope.temp.policy.readOnly){
- $scope.triggerdisabled = true;
- $scope.verificationdisabled = true;
- }else{
- $scope.triggerdisabled = false;
- $scope.verificationdisabled = false;
- }
-
+ if($scope.temp.policy.readOnly){
+ $scope.triggerdisabled = true;
+ $scope.verificationdisabled = true;
+ }else{
+ $scope.triggerdisabled = false;
+ $scope.verificationdisabled = false;
+ }
+
- PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- console.log($scope.onapNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_PEPOptionsDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.pepOptionsDictionaryDatas = JSON.parse($scope.data.pepOptionsDictionaryDatas);
- console.log($scope.pepOptionsDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_PEPOptionsDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.pepOptionsDictionaryDatas = JSON.parse($scope.data.pepOptionsDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_PEPOptionsData').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.pepOptionsDictionaryDataEntity = JSON.parse($scope.data.pepOptionsDictionaryDatas);
- console.log($scope.pepOptionsDictionaryDataEntity);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_PEPOptionsData').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.pepOptionsDictionaryDataEntity = JSON.parse($scope.data.pepOptionsDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VarbindDictionaryDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.varbindDictionaryDatas = JSON.parse($scope.data.varbindDictionaryDatas);
- console.log($scope.varbindDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VarbindDictionaryDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.varbindDictionaryDatas = JSON.parse($scope.data.varbindDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
- console.log($scope.vnfTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
- console.log($scope.vsclActionDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
+ });
- $scope.pepActionDictionaryDatas = [];
+ $scope.pepActionDictionaryDatas = [];
- $scope.getPepActionValues = function(pepOptionValue){
- for (var i = 0; i < $scope.pepOptionsDictionaryDataEntity.length; ++i) {
- var obj = $scope.pepOptionsDictionaryDataEntity[i];
- if (obj.pepName == pepOptionValue){
- var splitAlarm = obj.actions.split(':#@');
- for (var j = 0; j < splitAlarm.length; ++j) {
- $scope.pepActionDictionaryDatas.push(splitAlarm[j].split('=#@')[0]);
- }
- }
- }
- };
+ $scope.getPepActionValues = function(pepOptionValue){
+ for (var i = 0; i < $scope.pepOptionsDictionaryDataEntity.length; ++i) {
+ var obj = $scope.pepOptionsDictionaryDataEntity[i];
+ if (obj.pepName == pepOptionValue){
+ var splitAlarm = obj.actions.split(':#@');
+ for (var j = 0; j < splitAlarm.length; ++j) {
+ $scope.pepActionDictionaryDatas.push(splitAlarm[j].split('=#@')[0]);
+ }
+ }
+ }
+ };
- function trapData(){
- var data = {};
- if($scope.temp.policy.triggerTrapSignatures.length == 1 || $scope.temp.policy.triggerTrapSignatures["Trap1"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 }
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 2 || $scope.temp.policy.triggerTrapSignatures["Trap2"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2}
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 3 || $scope.temp.policy.triggerTrapSignatures["Trap3"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
- trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3}
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerTrapSignatures["Trap4"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
- trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4}
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 5 || $scope.temp.policy.triggerTrapSignatures["Trap5"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
- trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4,
- trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5}
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 6 || $scope.temp.policy.triggerTrapSignatures["Trap6"] != null){
- data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
- trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4,
- trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5, trap6 : $scope.temp.policy.triggerTrapSignatures.Trap6}
- }
- return data;
- }
-
- function faultDatas(){
- var faultData = {};
- if($scope.temp.policy.triggerfaultSignatures.length == 1 || $scope.temp.policy.triggerfaultSignatures["Fault1"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 }
- }
- if($scope.temp.policy.triggerfaultSignatures.length == 2 || $scope.temp.policy.triggerfaultSignatures["Fault2"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2}
- }
- if($scope.temp.policy.triggerfaultSignatures.length == 3 || $scope.temp.policy.triggerfaultSignatures["Fault3"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
- trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3}
- }
- if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerfaultSignatures["Fault4"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
- trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4}
- }
- if($scope.temp.policy.triggerfaultSignatures.length == 5 || $scope.temp.policy.triggerfaultSignatures["Fault5"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
- trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4,
- trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5}
- }
- if($scope.temp.policy.triggerfaultSignatures.length == 6 || $scope.temp.policy.triggerfaultSignatures["Fault6"] != null){
- faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
- trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4,
- trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5, trap6 : $scope.temp.policy.triggerfaultSignatures.Fault6}
- }
- return faultData;
- }
-
- $scope.saveFaultPolicy = function(policy){
- if(policy.itemContent != undefined){
- $scope.refreshCheck = true;
- $scope.policyNavigator = policy.itemContent;
- policy.itemContent = "";
- }
- $scope.savebutton = false;
- var data = trapData();
- var faultData = faultDatas();
- var uuu = "policycreation/save_policy";
- var postData={policyData: policy,
- trapData : data,
- faultData : faultData
- };
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.data=data.policyData;
- if($scope.data == 'success'){
- $scope.temp.policy.readOnly = 'true';
- $scope.pushStatus=data.policyData.split("&")[1];
- if($scope.pushStatus=="successPush"){
- Notification.success("Policy pushed successfully");
- }
- $scope.triggerdisabled = true;
- $scope.verificationdisabled = true;
- Notification.success("Policy Saved Successfully.");
- }else if ($scope.data == 'PolicyExists'){
- $scope.savebutton = true;
- Notification.error("Policy Already Exists with Same Name in Scope.");
- }
- });
- console.log($scope.data);
- },
- error : function(data){
- Notification.error("Error Occured while saving Policy.");
- }
- });
- };
+ function trapData(){
+ var data = {};
+ if($scope.temp.policy.triggerTrapSignatures.length == 1 || $scope.temp.policy.triggerTrapSignatures["Trap1"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 }
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 2 || $scope.temp.policy.triggerTrapSignatures["Trap2"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2}
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 3 || $scope.temp.policy.triggerTrapSignatures["Trap3"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
+ trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3}
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerTrapSignatures["Trap4"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
+ trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4}
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 5 || $scope.temp.policy.triggerTrapSignatures["Trap5"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
+ trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4,
+ trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5}
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 6 || $scope.temp.policy.triggerTrapSignatures["Trap6"] != null){
+ data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2,
+ trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4,
+ trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5, trap6 : $scope.temp.policy.triggerTrapSignatures.Trap6}
+ }
+ return data;
+ }
+
+ function faultDatas(){
+ var faultData = {};
+ if($scope.temp.policy.triggerfaultSignatures.length == 1 || $scope.temp.policy.triggerfaultSignatures["Fault1"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 }
+ }
+ if($scope.temp.policy.triggerfaultSignatures.length == 2 || $scope.temp.policy.triggerfaultSignatures["Fault2"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2}
+ }
+ if($scope.temp.policy.triggerfaultSignatures.length == 3 || $scope.temp.policy.triggerfaultSignatures["Fault3"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
+ trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3}
+ }
+ if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerfaultSignatures["Fault4"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
+ trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4}
+ }
+ if($scope.temp.policy.triggerfaultSignatures.length == 5 || $scope.temp.policy.triggerfaultSignatures["Fault5"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
+ trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4,
+ trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5}
+ }
+ if($scope.temp.policy.triggerfaultSignatures.length == 6 || $scope.temp.policy.triggerfaultSignatures["Fault6"] != null){
+ faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2,
+ trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4,
+ trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5, trap6 : $scope.temp.policy.triggerfaultSignatures.Fault6}
+ }
+ return faultData;
+ }
+
+ $scope.saveFaultPolicy = function(policy){
+ if(policy.itemContent != undefined){
+ $scope.refreshCheck = true;
+ $scope.policyNavigator = policy.itemContent;
+ policy.itemContent = "";
+ }
+ $scope.savebutton = false;
+ var data = trapData();
+ var faultData = faultDatas();
+ var uuu = "policycreation/save_policy";
+ var postData={policyData: policy,
+ trapData : data,
+ faultData : faultData
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.data=data.policyData;
+ if($scope.data == 'success'){
+ $scope.temp.policy.readOnly = 'true';
+ $scope.pushStatus=data.policyData.split("&")[1];
+ if($scope.pushStatus=="successPush"){
+ Notification.success("Policy pushed successfully");
+ }
+ $scope.triggerdisabled = true;
+ $scope.verificationdisabled = true;
+ Notification.success("Policy Saved Successfully.");
+ }else if ($scope.data == 'PolicyExists'){
+ $scope.savebutton = true;
+ Notification.error("Policy Already Exists with Same Name in Scope.");
+ }
+ });
+ },
+ error : function(data){
+ Notification.error("Error Occured while saving Policy.");
+ }
+ });
+ };
- $scope.validatePolicy = function(policy){
- console.log(policy);
- document.getElementById("validate").innerHTML = "";
- var uuu = "policyController/validate_policy.htm";
- var data = trapData();
- var faultData = faultDatas();
- var postData={policyData: policy, trapData : data, faultData : faultData};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.validateData = data.data.replace(/\"/g, "");
- $scope.data=data.data.substring(1,8);
- var size = data.data.length;
- if($scope.data == 'success'){
- Notification.success("Validation Success.");
- $scope.savebutton = false;
- if (size > 18){
- var displayWarning = data.data.substring(19,size);
- document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "skyblue";
- }
- }else{
- Notification.error("Validation Failed.");
- document.getElementById("validate").innerHTML = $scope.validateData;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "red";
- $scope.savebutton = true;
- }
+ $scope.validatePolicy = function(policy){
+ document.getElementById("validate").innerHTML = "";
+ var uuu = "policyController/validate_policy.htm";
+ var data = trapData();
+ var faultData = faultDatas();
+ var postData={policyData: policy, trapData : data, faultData : faultData};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.validateData = data.data.replace(/\"/g, "");
+ $scope.data=data.data.substring(1,8);
+ var size = data.data.length;
+ if($scope.data == 'success'){
+ Notification.success("Validation Success.");
+ $scope.savebutton = false;
+ if (size > 18){
+ var displayWarning = data.data.substring(19,size);
+ document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "skyblue";
+ }
+ }else{
+ Notification.error("Validation Failed.");
+ document.getElementById("validate").innerHTML = $scope.validateData;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "red";
+ $scope.savebutton = true;
+ }
- });
- console.log($scope.data);
- },
- error : function(data){
- Notification.error("Validation Failed.");
- $scope.savebutton = true;
- }
- });
- };
- if($scope.connectTriggerTrapsList == undefined){
- $scope.connectTriggerTrapsList = [];
- }
- if($scope.temp.policy.traptriggerSignatures == undefined){
- $scope.temp.policy.traptriggerSignatures = [];
- }
-
- $scope.ItemNo = 0;
- $scope.TriggerSignatureDatas = [{"triggerSignatures" : $scope.temp.policy.traptriggerSignatures}];
- $scope.addTriggerButton = function() {
- $scope.triggerdisabled = false;
- var newItemNo = $scope.temp.policy.traptriggerSignatures.length+1;
- $scope.ItemNo = newItemNo;
- $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+newItemNo});
- $scope.connectTriggerTrapsList.push('Trap'+newItemNo);
- };
- $scope.removeTriggerButton = function() {
- var lastItem = $scope.temp.policy.traptriggerSignatures.length-1;
- $scope.temp.policy.traptriggerSignatures.splice(lastItem);
- $scope.connectTriggerTrapsList.splice('Trap'+lastItem);
- };
+ });
+ },
+ error : function(data){
+ Notification.error("Validation Failed.");
+ $scope.savebutton = true;
+ }
+ });
+ };
+ if($scope.connectTriggerTrapsList == undefined){
+ $scope.connectTriggerTrapsList = [];
+ }
+ if($scope.temp.policy.traptriggerSignatures == undefined){
+ $scope.temp.policy.traptriggerSignatures = [];
+ }
+
+ $scope.ItemNo = 0;
+ $scope.TriggerSignatureDatas = [{"triggerSignatures" : $scope.temp.policy.traptriggerSignatures}];
+ $scope.addTriggerButton = function() {
+ $scope.triggerdisabled = false;
+ var newItemNo = $scope.temp.policy.traptriggerSignatures.length+1;
+ $scope.ItemNo = newItemNo;
+ $scope.temp.policy.traptriggerSignatures.push({'id':'Trap'+newItemNo});
+ $scope.connectTriggerTrapsList.push('Trap'+newItemNo);
+ };
+ $scope.removeTriggerButton = function() {
+ var lastItem = $scope.temp.policy.traptriggerSignatures.length-1;
+ $scope.temp.policy.traptriggerSignatures.splice(lastItem);
+ $scope.connectTriggerTrapsList.splice('Trap'+lastItem);
+ };
-
- $scope.trapItemNo = 0;
- $scope.TrapTriggerSignatureDatas = [{"triggermainSignatures" : $scope.temp.policy.triggerTrapSignatures}];
- $scope.addTrapTriggerButton = function(indexId) {
- if(trapCollection.indexOf(indexId) === -1){
- $scope.temp.policy.triggerTrapSignatures[indexId] = [];
- trapCollection.push(indexId);
- }
- var newTrapItemNo = $scope.temp.policy.triggerTrapSignatures[indexId].length+1;
- $scope.trapItemNo = newTrapItemNo;
- $scope.temp.policy.triggerTrapSignatures.push($scope.temp.policy.triggerTrapSignatures[indexId].push({'id':'A'+newTrapItemNo}));
- if(newTrapItemNo > 1){
- var count = newTrapItemNo-1;
- $scope.varbindDictionaryDatas.push('A'+count);
- }
- };
- $scope.removeTrapTriggerButton = function(indexId) {
- var lastTrapItem = $scope.temp.policy.triggerTrapSignatures[indexId].length-1;
- var checkLastTrapItem = lastTrapItem;
- if(checkLastTrapItem == 0){
- trapCollection.splice(indexId);
- }
- $scope.temp.policy.triggerTrapSignatures[indexId].splice(lastTrapItem);
- };
+
+ $scope.trapItemNo = 0;
+ $scope.TrapTriggerSignatureDatas = [{"triggermainSignatures" : $scope.temp.policy.triggerTrapSignatures}];
+ $scope.addTrapTriggerButton = function(indexId) {
+ if(trapCollection.indexOf(indexId) === -1){
+ $scope.temp.policy.triggerTrapSignatures[indexId] = [];
+ trapCollection.push(indexId);
+ }
+ var newTrapItemNo = $scope.temp.policy.triggerTrapSignatures[indexId].length+1;
+ $scope.trapItemNo = newTrapItemNo;
+ $scope.temp.policy.triggerTrapSignatures.push($scope.temp.policy.triggerTrapSignatures[indexId].push({'id':'A'+newTrapItemNo}));
+ if(newTrapItemNo > 1){
+ var count = newTrapItemNo-1;
+ $scope.varbindDictionaryDatas.push('A'+count);
+ }
+ };
+ $scope.removeTrapTriggerButton = function(indexId) {
+ var lastTrapItem = $scope.temp.policy.triggerTrapSignatures[indexId].length-1;
+ var checkLastTrapItem = lastTrapItem;
+ if(checkLastTrapItem == 0){
+ trapCollection.splice(indexId);
+ }
+ $scope.temp.policy.triggerTrapSignatures[indexId].splice(lastTrapItem);
+ };
- if($scope.temp.policy.connecttriggerSignatures == undefined){
- $scope.temp.policy.connecttriggerSignatures = [];
- }
-
- $scope.connecttrapItemNo = 0;
- $scope.TrapConnectTriggerSignatureDatas = [{"connecttriggerSignatures" : $scope.temp.policy.connecttriggerSignatures}];
- $scope.addTriggerConnectButton = function() {
- var newConnectTrapItemNo = $scope.temp.policy.connecttriggerSignatures.length+1;
- $scope.connecttrapItemNo = newConnectTrapItemNo;
- $scope.temp.policy.connecttriggerSignatures.push({'id':'C'+newConnectTrapItemNo});
- if(newConnectTrapItemNo >1){
- var count = newConnectTrapItemNo-1;
- $scope.connectTriggerTrapsList.push('C'+count);
- }
- };
- $scope.removeTriggerConnectButton = function() {
- var lastConnectTrapItem = $scope.temp.policy.connecttriggerSignatures.length-1;
- $scope.temp.policy.connecttriggerSignatures.splice(lastConnectTrapItem);
- if(lastConnectTrapItem < 1){
- var count = lastConnectTrapItem-1;
- $scope.connectTriggerTrapsList.splice('C'+count);
- }
- };
- if($scope.connectTriggerFaultsList == undefined){
- $scope.connectTriggerFaultsList = [];
- }
- if($scope.temp.policy.faulttriggerSignatures == undefined){
- $scope.temp.policy.faulttriggerSignatures = [];
- }
-
- $scope.FaultItemNo = 0;
- $scope.FaultSignatureDatas = [{"verificationmainSignatures" : $scope.temp.policy.faulttriggerSignatures}];
- $scope.addVerFaultButton = function() {
- var newFaultItemNo = $scope.temp.policy.faulttriggerSignatures.length+1;
- $scope.FaultItemNo = newFaultItemNo;
- $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+newFaultItemNo});
- $scope.connectTriggerFaultsList.push('Fault'+newFaultItemNo);
- };
- $scope.removeVerFaultButton = function() {
- var lastFaultItem = $scope.temp.policy.faulttriggerSignatures.length-1;
- $scope.temp.policy.faulttriggerSignatures.splice(lastFaultItem);
- $scope.connectTriggerFaultsList.splice('Fault'+lastFaultItem);
- };
- if($scope.temp.policy.triggerfaultSignatures == undefined){
- $scope.temp.policy.triggerfaultSignatures = [];
- }
-
- $scope.faultItemNo1 = 0;
- $scope.FaultTriggerSignatureDatas = [{"verificationSignatures" : $scope.temp.policy.triggerfaultSignatures}];
- $scope.addVerTriggerButton = function(indexId) {
- $scope.verificationdisabled = false;
- if(faultCollection.indexOf(indexId) === -1){
- $scope.temp.policy.triggerfaultSignatures[indexId] = [];
- faultCollection.push(indexId);
- }
- var newFaultItemNo1 = $scope.temp.policy.triggerfaultSignatures[indexId].length+1;
- $scope.faultItemNo1 = newFaultItemNo1;
- $scope.temp.policy.triggerfaultSignatures.push($scope.temp.policy.triggerfaultSignatures[indexId].push({'id':'A'+newFaultItemNo1}));
- if(newFaultItemNo1 > 1){
- var count = newFaultItemNo1-1;
- $scope.varbindDictionaryDatas.push('A'+count);
- }
- };
- $scope.removeVerTriggerButton = function(indexId) {
- var lastFaultItem1 = $scope.temp.policy.triggerfaultSignatures[indexId].length-1;
- var checkLastFaultItem = lastFaultItem1;
- if(checkLastFaultItem == 0){
- faultCollection.splice(indexId);
- }
- $scope.temp.policy.triggerfaultSignatures[indexId].splice(lastFaultItem1);
- };
+ if($scope.temp.policy.connecttriggerSignatures == undefined){
+ $scope.temp.policy.connecttriggerSignatures = [];
+ }
+
+ $scope.connecttrapItemNo = 0;
+ $scope.TrapConnectTriggerSignatureDatas = [{"connecttriggerSignatures" : $scope.temp.policy.connecttriggerSignatures}];
+ $scope.addTriggerConnectButton = function() {
+ var newConnectTrapItemNo = $scope.temp.policy.connecttriggerSignatures.length+1;
+ $scope.connecttrapItemNo = newConnectTrapItemNo;
+ $scope.temp.policy.connecttriggerSignatures.push({'id':'C'+newConnectTrapItemNo});
+ if(newConnectTrapItemNo >1){
+ var count = newConnectTrapItemNo-1;
+ $scope.connectTriggerTrapsList.push('C'+count);
+ }
+ };
+ $scope.removeTriggerConnectButton = function() {
+ var lastConnectTrapItem = $scope.temp.policy.connecttriggerSignatures.length-1;
+ $scope.temp.policy.connecttriggerSignatures.splice(lastConnectTrapItem);
+ if(lastConnectTrapItem < 1){
+ var count = lastConnectTrapItem-1;
+ $scope.connectTriggerTrapsList.splice('C'+count);
+ }
+ };
+ if($scope.connectTriggerFaultsList == undefined){
+ $scope.connectTriggerFaultsList = [];
+ }
+ if($scope.temp.policy.faulttriggerSignatures == undefined){
+ $scope.temp.policy.faulttriggerSignatures = [];
+ }
+
+ $scope.FaultItemNo = 0;
+ $scope.FaultSignatureDatas = [{"verificationmainSignatures" : $scope.temp.policy.faulttriggerSignatures}];
+ $scope.addVerFaultButton = function() {
+ var newFaultItemNo = $scope.temp.policy.faulttriggerSignatures.length+1;
+ $scope.FaultItemNo = newFaultItemNo;
+ $scope.temp.policy.faulttriggerSignatures.push({'id':'Fault'+newFaultItemNo});
+ $scope.connectTriggerFaultsList.push('Fault'+newFaultItemNo);
+ };
+ $scope.removeVerFaultButton = function() {
+ var lastFaultItem = $scope.temp.policy.faulttriggerSignatures.length-1;
+ $scope.temp.policy.faulttriggerSignatures.splice(lastFaultItem);
+ $scope.connectTriggerFaultsList.splice('Fault'+lastFaultItem);
+ };
+ if($scope.temp.policy.triggerfaultSignatures == undefined){
+ $scope.temp.policy.triggerfaultSignatures = [];
+ }
+
+ $scope.faultItemNo1 = 0;
+ $scope.FaultTriggerSignatureDatas = [{"verificationSignatures" : $scope.temp.policy.triggerfaultSignatures}];
+ $scope.addVerTriggerButton = function(indexId) {
+ $scope.verificationdisabled = false;
+ if(faultCollection.indexOf(indexId) === -1){
+ $scope.temp.policy.triggerfaultSignatures[indexId] = [];
+ faultCollection.push(indexId);
+ }
+ var newFaultItemNo1 = $scope.temp.policy.triggerfaultSignatures[indexId].length+1;
+ $scope.faultItemNo1 = newFaultItemNo1;
+ $scope.temp.policy.triggerfaultSignatures.push($scope.temp.policy.triggerfaultSignatures[indexId].push({'id':'A'+newFaultItemNo1}));
+ if(newFaultItemNo1 > 1){
+ var count = newFaultItemNo1-1;
+ $scope.varbindDictionaryDatas.push('A'+count);
+ }
+ };
+ $scope.removeVerTriggerButton = function(indexId) {
+ var lastFaultItem1 = $scope.temp.policy.triggerfaultSignatures[indexId].length-1;
+ var checkLastFaultItem = lastFaultItem1;
+ if(checkLastFaultItem == 0){
+ faultCollection.splice(indexId);
+ }
+ $scope.temp.policy.triggerfaultSignatures[indexId].splice(lastFaultItem1);
+ };
- if($scope.temp.policy.connectVerificationSignatures == undefined){
- $scope.temp.policy.connectVerificationSignatures = [];
- }
-
- $scope.connectFaultItemNo = 0;
- $scope.FaultConnectTriggerSignatureDatas = [{"connectVerificationSignatures" : $scope.temp.policy.connectVerificationSignatures}];
- $scope.addFaultConnectButton = function() {
- var newConnectFaultItemNo = $scope.temp.policy.connectVerificationSignatures.length+1;
- $scope.connectFaultItemNo = newConnectFaultItemNo;
- $scope.temp.policy.connectVerificationSignatures.push({'id':'C'+newConnectFaultItemNo});
- if(newConnectFaultItemNo >1){
- var count = newConnectFaultItemNo-1;
- $scope.connectTriggerFaultsList.push('C'+count);
- }
- };
- $scope.removeFaultConnectButton = function() {
- var lastConnectFaultItem = $scope.temp.policy.connectVerificationSignatures.length-1;
- $scope.temp.policy.connectVerificationSignatures.splice(lastConnectFaultItem);
- if(lastConnectFaultItem < 1){
- var count = lastConnectFaultItem-1;
- $scope.connectTriggerFaultsList.splice('C'+count);
- }
- };
+ if($scope.temp.policy.connectVerificationSignatures == undefined){
+ $scope.temp.policy.connectVerificationSignatures = [];
+ }
+
+ $scope.connectFaultItemNo = 0;
+ $scope.FaultConnectTriggerSignatureDatas = [{"connectVerificationSignatures" : $scope.temp.policy.connectVerificationSignatures}];
+ $scope.addFaultConnectButton = function() {
+ var newConnectFaultItemNo = $scope.temp.policy.connectVerificationSignatures.length+1;
+ $scope.connectFaultItemNo = newConnectFaultItemNo;
+ $scope.temp.policy.connectVerificationSignatures.push({'id':'C'+newConnectFaultItemNo});
+ if(newConnectFaultItemNo >1){
+ var count = newConnectFaultItemNo-1;
+ $scope.connectTriggerFaultsList.push('C'+count);
+ }
+ };
+ $scope.removeFaultConnectButton = function() {
+ var lastConnectFaultItem = $scope.temp.policy.connectVerificationSignatures.length-1;
+ $scope.temp.policy.connectVerificationSignatures.splice(lastConnectFaultItem);
+ if(lastConnectFaultItem < 1){
+ var count = lastConnectFaultItem-1;
+ $scope.connectTriggerFaultsList.splice('C'+count);
+ }
+ };
}]);
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
index 08f0aa7ea..873bdb104 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
@@ -71,60 +71,38 @@ angular.module('abs').controller('dcaeMicroServiceController',
PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- console.log($scope.onapNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.priorityDatas = JSON.parse($scope.data.priorityDatas);
- console.log($scope.priorityDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_GroupPolicyScopeDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.groupPolicyScopeListDatas = JSON.parse($scope.data.groupPolicyScopeListDatas);
- console.log($scope.groupPolicyScopeListDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_MicroServiceConfigNameDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
- console.log("$scope.data.microServiceConfigNameDictionaryDatas : " + $scope.data.microServiceConfigNameDictionaryDatas);
if($scope.data.microServiceConfigNameDictionaryDatas){
$scope.microServiceCongigNameDictionaryDatas = JSON.parse($scope.data.microServiceConfigNameDictionaryDatas);
}
- console.log($scope.microServiceCongigNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_MicroServiceLocationDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.microServiceLocationDictionaryDatas = JSON.parse($scope.data.microServiceLocationDictionaryDatas);
- console.log($scope.microServiceLocationDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_MicroServiceModelsDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
var inputModelList = JSON.parse($scope.data.microServiceModelsDictionaryDatas);
var unique = {};
var uniqueList = [];
@@ -135,55 +113,37 @@ angular.module('abs').controller('dcaeMicroServiceController',
}
}
$scope.microServiceModelsDictionaryDatas = uniqueList;
- console.log($scope.microServiceModelsDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_DCAEUUIDDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.dcaeUUIDDictionaryDatas = JSON.parse($scope.data.dcaeUUIDDictionaryDatas);
- console.log($scope.dcaeUUIDDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_MicroServiceAttributeData').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.microServiceAttributeDictionaryDatas = JSON.parse($scope.data.microServiceAttributeDictionaryDatas);
- console.log($scope.microServiceAttributeDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
$scope.choices = [];
$scope.attributeDatas = [{"attributes" : $scope.choices}];
addNewChoice = function(value) {
- console.log("input key : " + value);
var isFoundInRuleData = false;
if(value != undefined){
if (value.startsWith('div.')){
value = value.replace('div.','');
}
- console.log(" document.getElementById : div."+value);
var parentElement = document.getElementById("div."+value);
- console.log("parentElement : " + parentElement);
var div = document.getElementById(value+"@0");
if(div != null){
var clone = div.cloneNode(true);
@@ -196,8 +156,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
clone.value = $scope.temp.policy.ruleData[clone.id];
isFoundInRuleData = true;
}
- console.log(" clone.value :" + clone.value);
- console.log(" clone.id :" + clone.id);
if(!isFoundInRuleData && isInitViewEdit){
return;
}
@@ -255,8 +213,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
for(var i=0; i<inputs.length; i++){
if ($scope.temp.policy.ruleData!=undefined){
var checkValue = $scope.temp.policy.ruleData[inputs[i].id];
- console.log(" checkValue.value :" + checkValue);
- console.log(" inputs["+i+"].id :" + inputs[i].id);
if (checkValue!=undefined && checkValue != "undefined"){
document.getElementById(inputs[i].id).value = checkValue;
plainAttributeKeys.push(inputs[i].id);
@@ -301,7 +257,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
removeChoice = function(value) {
- console.log(value);
if(value != undefined){
var c = document.getElementById("div."+value).childElementCount;
@@ -329,7 +284,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
}
$scope.pullVersion = function(serviceName) {
- console.log(serviceName);
if(serviceName != undefined){
var uuu = "policyController/getModelServiceVersioneData.htm";
var postData={policyData: serviceName};
@@ -369,7 +323,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var uuu = "policyController/getDCAEMSTemplateData.htm";
var postData={policyData: service};
- console.log("service: " +service);
var dataOrderInfo = "";
@@ -392,19 +345,12 @@ angular.module('abs').controller('dcaeMicroServiceController',
$scope.dcaeJsonDate = data[0].jsonValue;
$scope.dataOrderInfo = null;
$scope.dataOrderInfo = data[0].dataOrderInfo;
- console.log("data[0].dataOrderInfo: " + data[0].dataOrderInfo);
- console.log("$scope.dataOrderInfo: " + $scope.dataOrderInfo);
if(data[0].allManyTrueKeys){
- console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys);
}
- console.log("$scope.dcaeJsonDate: " + $scope.dcaeJsonDate);
var attributes = $scope.dcaeModelData.attributes;
- console.log("attributes: " +attributes);
var refAttributes = $scope.dcaeModelData.ref_attributes;
var subAttributes = $scope.dcaeModelData.sub_attributes;
- console.log("subAttributes: " + subAttributes);
- console.log("refAttributes: " + refAttributes);
var headDefautlsData = data[0].headDefautlsData;
if(headDefautlsData != null){
$scope.temp.policy.onapName = headDefautlsData.onapName;
@@ -440,7 +386,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
conpairService = service;
}
if(valueModel.localeCompare(conpairService) == 0){
- console.log(valueCompare);
dictionaryList.push(dictionary[m]);
if (!dictionaryNameList.includes(dictionary[m].name)){
dictionaryNameList.push(dictionary[m].name)
@@ -464,7 +409,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var checkData = [];
var data = [];
// If ruleData contains extra elements created by clicked add button
- console.log("$scope.temp.policy.ruleData:" + $scope.temp.policy.ruleData);
if($scope.temp.policy.ruleData != null){
var propNames = Object.getOwnPropertyNames($scope.temp.policy.ruleData);
propNames.forEach(function(name) {
@@ -492,7 +436,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var n = getNumOfDigits(extraElements[a], index+1);
var key = extraElements[a].substring(0, index+n+1); //include @x in key also by n+2 since x can be 1,12, etc
- console.log("key: " + key);
checkData.push(key);
}
}
@@ -506,7 +449,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var lastIndex = unique[i].lastIndexOf("@");
if(firstIndex == lastIndex){
var newKey = unique[i].substring(0, firstIndex);
- console.log("root element: " + newKey);
parentLevelElements.push(newKey);
unique[i] = "*processed*";
}
@@ -531,7 +473,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
if(unique[i] != "*processed*"){
var index = unique[i].lastIndexOf("@");
var newKey = unique[i].substring(0, index);
- console.log("newKey: " + newKey);
var newElement = document.getElementById("div."+unique[j]);
//check weather it has been created already
@@ -635,7 +576,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
function getList(attribute) {
var enumName = attribute;
- console.log("In getList: attribute => " + attribute);
if(attribute){
if(attribute.includes(":")){
enumName = attribute.split(":")[0];
@@ -705,7 +645,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
for (key in layOutData) {
array = isArray(layOutData[key]);
- console.log("key: " + key , "value: " + layOutData[key]);
if (!!layOutData[key] && typeof(layOutData[key])=="object") {
@@ -783,7 +722,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var jsonObject = JSON.parse(subAttributes);
var lablInfo = findVal(jsonObject, attributekey);
- console.log("deconstructJSON:findValue : " + attributekey +": "+ lablInfo);
if (lablInfo){
if(lablInfo.includes('required-true')){
isRequired = true;
@@ -801,7 +739,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
if(allkeys){
for (var k = 0; k < allkeys.length; k++) {
var keyValue = allkeys[k];
- console.log(" keyValue:jsonObject["+keyValue+ "]: " + jsonObject[keyValue]);
if(jsonObject[keyValue]){
var tempObject = jsonObject[keyValue];
if(tempObject && tempObject[key]){
@@ -898,14 +835,11 @@ angular.module('abs').controller('dcaeMicroServiceController',
$scope.validContionalRequired = function(parentId) {
- console.log("ng-blur event: parentId : " + parentId);
var c = document.getElementById(parentId).children;
var i;
var hasValue = false;
for (i = 0; i < c.length; i++) {
if(c[i].getAttribute("data-conditional")){
- console.log(c[i].getAttribute("data-conditional"));
- console.log(c[i].value);
if(c[i].value != null && c[i].value.trim() != ""){
hasValue = true;
}
@@ -947,7 +881,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
orderValue = orderValue.split(',') ;
for (var i = 0; i < orderValue.length; i++) {
- console.log("orderValue["+i+"]"+ orderValue[i]);
var key = orderValue[i].trim();
//--- Create labels first {"label" : newKey, "level" : baseLevel, "array" : array};
@@ -978,8 +911,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var description = layOutElementList[j].description;
var isRequired = layOutElementList[j].isRequired;
- console.log("layOutElementList[" +j+ "]: id:" + layOutElementList[j].id + ", attributekey:"+ layOutElementList[j].attributekey + ", attirbuteLabel:" + layOutElementList[j].attirbuteLabel);
- console.log("layOutElementList[" +j+ "]: type:" + layOutElementList[j].type);
if (layOutElementList[j].type == "dropBox"){
$scope.dropBoxLayout(attirbuteLabel, attributekey, layOutElementList[j].array, defaultValue, layOutElementList[j].list, isRequired, description);
@@ -1167,8 +1098,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
}
}
}
- console.log('firstChild_Id: ' + firstChild_Id);
- console.log('divID: ' + divID);
if(dataType != "boolean" && defaultValue.length > 0){
if(defaultValue.includes(":")){
@@ -1217,7 +1146,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
var subAttributes = $scope.dcaeModelData.sub_attributes;
var jsonObject = JSON.parse(subAttributes);
var lablInfo = findVal(jsonObject, lableName);
- console.log("findValue : " + lableName +": "+ lablInfo);
var star = "";
var required = null;
if(lablInfo){
@@ -1390,7 +1318,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
PolicyAppService.getData(dictParamsSplit[0]).then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.listDictionarys = JSON.parse($scope.data[dictParamsSplit[1]]);
for (i=0; i < $scope.listDictionarys.length; i += 1) {
option = document.createElement('option');
@@ -1398,8 +1325,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
option.appendChild(document.createTextNode($scope.listDictionarys[i]));
listField.appendChild(option);
}
- }, function (error) {
- console.log("failed");
});
}
@@ -1511,7 +1436,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
if(plainAttributeKeys != null){
for(a = 0; a < plainAttributeKeys.length; a++){
var splitPlainAttributeKey = plainAttributeKeys[a].split(splitAt);
- console.log("splitPlainAttributeKey: " + splitPlainAttributeKey);
var searchElement = document.getElementById(splitPlainAttributeKey[0]);
var key = splitPlainAttributeKey[0];
if(searchElement == null){
@@ -1537,7 +1461,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
}
jsonPolicy[key]= multiSlect;
}else{
- console.log(" searchElement.value = > " + searchElement.value);
if(splitPlainAttributeKey[1]!= undefined && splitPlainAttributeKey[1] == "boolean"){
jsonPolicy[key]= false;
for(var i=0; i<booleanTrueElements.length; i++){
@@ -1553,7 +1476,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
} else {
if(searchElement.value != null){
jsonPolicy[key]= searchElement.value;
- console.log(" searchElement.value = > " + searchElement.value);
if(splitPlainAttributeKey[1] == "boolean"){
jsonPolicy[key]= false;
for(var i=0; i<booleanTrueElements.length; i++){
@@ -1594,7 +1516,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
Notification.error("Policy Already Exists with Same Name in Scope.");
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Error Occured while saving Policy.");
@@ -1610,7 +1531,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
if(plainAttributeKeys != null){
for(a = 0; a < plainAttributeKeys.length; a++){
var splitPlainAttributeKey = plainAttributeKeys[a].split(splitAt);
- console.log(splitPlainAttributeKey[1]);
var searchElement = document.getElementById(splitPlainAttributeKey[0]);
var key = splitPlainAttributeKey[0];
if(searchElement == null){
@@ -1656,16 +1576,13 @@ angular.module('abs').controller('dcaeMicroServiceController',
if(checkedValue){
- console.log("checkedValue:" + checkedValue);
for(var i=0; i<x.length; x++){
- console.log("checkbox id: " + x[i].id);
booleanTrueElements.push(x[i].id)
}
}
}
var uuu = "policyController/validate_policy.htm";
- console.log("$scope.isCheck:" + $scope.isCheck);
if($scope.isCheck == true){
if(("configName" in policy) == false){
@@ -1720,7 +1637,6 @@ angular.module('abs').controller('dcaeMicroServiceController',
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Validation Failed.");
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index 9596d0f29..4d63dbe3f 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -17,438 +17,411 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-angular.module('abs').controller('decisionPolicyController', [ '$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', '$http', function($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification, $http) {
- $("#dialog").hide();
-
- $scope.policyNavigator;
- $scope.savebutton = true;
- $scope.refreshCheck = false;
- $scope.disableOnCreate = false;
- $scope.notRawPolicy = true;
-
- if (!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly) {
- $scope.disableOnCreate = true;
- $scope.temp.policy = {
- policyType : "Decision"
- }
- }
-
- $scope.refresh = function() {
- if ($scope.refreshCheck) {
- $scope.policyNavigator.refresh();
- }
- $scope.modal('createNewPolicy', true);
- $scope.temp.policy = "";
- };
-
- $scope.modal = function(id, hide) {
- return $('#' + id).modal(hide ? 'hide' : 'show');
- };
-
- if ($scope.temp.policy.ruleProvider == undefined) {
- $scope.temp.policy.ruleProvider = "Custom";
- }
-
- if ($scope.temp.policy.blackListEntryType == undefined) {
- $scope.temp.policy.blackListEntryType = "Use Manual Entry";
- }
-
- PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- console.log($scope.onapNameDictionaryDatas);
- }, function(error) {
- console.log("failed");
- });
-
- PolicyAppService.getData('getDictionary/get_SettingsDictionaryDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.settingsDictionaryDatas = JSON.parse($scope.data.settingsDictionaryDatas);
- console.log($scope.settingsDictionaryDatas);
- }, function(error) {
- console.log("failed");
- });
-
- PolicyAppService.getData('get_FunctionDefinitionDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.functionDefinitionDatas = JSON.parse($scope.data.functionDefinitionDatas);
- console.log($scope.functionDefinitionDatas);
- }, function(error) {
- console.log("failed");
- });
-
- PolicyAppService.getData('getDictionary/get_AttributeDatabyAttributeName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.attributeDictionaryDatas = JSON.parse($scope.data.attributeDictionaryDatas);
- console.log($scope.attributeDictionaryDatas);
- }, function(error) {
- console.log("failed");
- });
-
- PolicyAppService.getData('getDictionary/get_RainyDayDictionaryDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.rainyDayDictionaryDatas = JSON.parse($scope.data.rainyDayDictionaryDatas);
- console.log($scope.rainyDayDictionaryDatas);
- }, function(error) {
- console.log("failed");
- });
-
- PolicyAppService.getData('getDictionary/get_RainyDayDictionaryData').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.rainyDayDictionaryDataEntity = JSON.parse($scope.data.rainyDayDictionaryDatas);
- console.log($scope.rainyDayDictionaryDatasEntity);
- }, function(error) {
- console.log("failed");
- });
-
- $scope.saveDecisionPolicy = function(policy) {
- if (policy.itemContent != undefined) {
- $scope.refreshCheck = true;
- $scope.policyNavigator = policy.itemContent;
- policy.itemContent = "";
- }
- $scope.savebutton = false;
- console.log(policy);
- var uuu = "policycreation/save_policy";
- var postData = {
- policyData : policy
- };
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType : 'json',
- contentType : 'application/json',
- data : JSON.stringify(postData),
- success : function(data) {
- $scope.$apply(function() {
- $scope.data = data.policyData;
- if ($scope.data == 'success') {
- $scope.temp.policy.readOnly = 'true';
- Notification.success("Policy Saved Successfully.");
- } else if ($scope.data == 'PolicyExists') {
- $scope.savebutton = true;
- Notification.error("Policy Already Exists with Same Name in Scope.");
- }
- });
- console.log($scope.data);
-
- },
- error : function(data) {
- Notification.error("Error Occured while saving Policy.");
- }
- });
- };
-
- $scope.validatePolicy = function(policy) {
- console.log(policy);
- document.getElementById("validate").innerHTML = "";
- var uuu = "policyController/validate_policy.htm";
- var postData = {
- policyData : policy
- };
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType : 'json',
- contentType : 'application/json',
- data : JSON.stringify(postData),
- success : function(data) {
- $scope.$apply(function() {
- $scope.validateData = data.data.replace(/\"/g, "");
- $scope.data = data.data;
- if ($scope.data == '"success"') {
- Notification.success("Validation Success.");
- $scope.savebutton = false;
- } else {
- Notification.error("Validation Failed.");
- document.getElementById("validate").innerHTML = $scope.validateData;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "red";
- $scope.savebutton = true;
- }
-
- });
- console.log($scope.data);
- },
- error : function(data) {
- Notification.error("Validation Failed.");
- $scope.savebutton = true;
- }
- });
- };
-
- if (!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly) {
- $scope.temp.policy.attributes = [];
- $scope.temp.policy.settings = [];
- $scope.temp.policy.ruleAlgorithmschoices = [];
- if (!$scope.temp.policy.yamlparams) {
- $scope.temp.policy.yamlparams = {};
- }
- if (!$scope.temp.policy.yamlparams.targets) {
- $scope.temp.policy.yamlparams.targets = [];
- }
- if (!$scope.temp.policy.yamlparams.blackList) {
- $scope.temp.policy.yamlparams.blackList = [];
- }
- if (!$scope.temp.policy.rainyday) {
- $scope.temp.policy.rainyday = {};
- }
- if (!$scope.temp.policy.rainyday.treatmentTableChoices) {
- $scope.temp.policy.rainyday.treatmentTableChoices = [];
- }
-
- } else if ($scope.temp.policy.ruleProvider == "Custom") {
- if ($scope.temp.policy.attributes.length == 0) {
- $scope.temp.policy.attributes = [];
- }
- if ($scope.temp.policy.settings.length == 0) {
- $scope.temp.policy.settings = [];
- }
- if ($scope.temp.policy.ruleAlgorithmschoices == null || $scope.temp.policy.ruleAlgorithmschoices.length == 0) {
- $scope.temp.policy.ruleAlgorithmschoices = [];
- }
- } else if ($scope.temp.policy.ruleProvider == "GUARD_BL_YAML") {
- if ($scope.temp.policy.yamlparams.blackList == null || $scope.temp.policy.yamlparams.blackList.length == 0) {
- $scope.temp.policy.yamlparams.blackList = [];
- }
- if ($scope.temp.policy.blackListEntries == null || $scope.temp.policy.blackListEntries.length == 0) {
- $scope.temp.policy.blackListEntries = [];
- }
- $scope.blackListEntries = [];
- $scope.temp.policy.appendBlackListEntries = [];
- $scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList));
-
+angular.module('abs').controller('decisionPolicyController',
+ [ '$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', '$http',
+ function($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification, $http) {
+ $("#dialog").hide();
+
+ $scope.policyNavigator;
+ $scope.savebutton = true;
+ $scope.refreshCheck = false;
+ $scope.disableOnCreate = false;
+ $scope.notRawPolicy = true;
+
+ if (!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly) {
+ $scope.disableOnCreate = true;
+ $scope.temp.policy = {
+ policyType : "Decision"
+ }
+ }
+
+ $scope.refresh = function() {
+ if ($scope.refreshCheck) {
+ $scope.policyNavigator.refresh();
+ }
+ $scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
+ };
+
+ $scope.modal = function(id, hide) {
+ return $('#' + id).modal(hide ? 'hide' : 'show');
+ };
+
+ if ($scope.temp.policy.ruleProvider == undefined) {
+ $scope.temp.policy.ruleProvider = "Custom";
+ }
+
+ if ($scope.temp.policy.blackListEntryType == undefined) {
+ $scope.temp.policy.blackListEntryType = "Use Manual Entry";
+ }
+
+ PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+ });
+
+ PolicyAppService.getData('getDictionary/get_SettingsDictionaryDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.settingsDictionaryDatas = JSON.parse($scope.data.settingsDictionaryDatas);
+ });
+
+ PolicyAppService.getData('get_FunctionDefinitionDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.functionDefinitionDatas = JSON.parse($scope.data.functionDefinitionDatas);
+ });
+
+ PolicyAppService.getData('getDictionary/get_AttributeDatabyAttributeName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.attributeDictionaryDatas = JSON.parse($scope.data.attributeDictionaryDatas);
+ });
+
+ PolicyAppService.getData('getDictionary/get_RainyDayDictionaryDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.rainyDayDictionaryDatas = JSON.parse($scope.data.rainyDayDictionaryDatas);
+ });
+
+ PolicyAppService.getData('getDictionary/get_RainyDayDictionaryData').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.rainyDayDictionaryDataEntity = JSON.parse($scope.data.rainyDayDictionaryDatas);
+ });
+
+ $scope.saveDecisionPolicy = function(policy) {
+ if (policy.itemContent != undefined) {
+ $scope.refreshCheck = true;
+ $scope.policyNavigator = policy.itemContent;
+ policy.itemContent = "";
+ }
+ $scope.savebutton = false;
+ var uuu = "policycreation/save_policy";
+ var postData = {
+ policyData : policy
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType : 'json',
+ contentType : 'application/json',
+ data : JSON.stringify(postData),
+ success : function(data) {
+ $scope.$apply(function() {
+ $scope.data = data.policyData;
+ if ($scope.data == 'success') {
+ $scope.temp.policy.readOnly = 'true';
+ Notification.success("Policy Saved Successfully.");
+ } else if ($scope.data == 'PolicyExists') {
+ $scope.savebutton = true;
+ Notification.error("Policy Already Exists with Same Name in Scope.");
+ }
+ });
+
+ },
+ error : function(data) {
+ Notification.error("Error Occured while saving Policy.");
+ }
+ });
+ };
+
+ $scope.validatePolicy = function(policy) {
+ document.getElementById("validate").innerHTML = "";
+ var uuu = "policyController/validate_policy.htm";
+ var postData = {
+ policyData : policy
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType : 'json',
+ contentType : 'application/json',
+ data : JSON.stringify(postData),
+ success : function(data) {
+ $scope.$apply(function() {
+ $scope.validateData = data.data.replace(/\"/g, "");
+ $scope.data = data.data;
+ if ($scope.data == '"success"') {
+ Notification.success("Validation Success.");
+ $scope.savebutton = false;
+ } else {
+ Notification.error("Validation Failed.");
+ document.getElementById("validate").innerHTML = $scope.validateData;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "red";
+ $scope.savebutton = true;
+ }
+
+ });
+ },
+ error : function(data) {
+ Notification.error("Validation Failed.");
+ $scope.savebutton = true;
+ }
+ });
+ };
+
+ if (!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly) {
+ $scope.temp.policy.attributes = [];
+ $scope.temp.policy.settings = [];
+ $scope.temp.policy.ruleAlgorithmschoices = [];
+ if (!$scope.temp.policy.yamlparams) {
+ $scope.temp.policy.yamlparams = {};
+ }
+ if (!$scope.temp.policy.yamlparams.targets) {
+ $scope.temp.policy.yamlparams.targets = [];
+ }
+ if (!$scope.temp.policy.yamlparams.blackList) {
+ $scope.temp.policy.yamlparams.blackList = [];
+ }
+ if (!$scope.temp.policy.rainyday) {
+ $scope.temp.policy.rainyday = {};
+ }
+ if (!$scope.temp.policy.rainyday.treatmentTableChoices) {
+ $scope.temp.policy.rainyday.treatmentTableChoices = [];
+ }
+
+ } else if ($scope.temp.policy.ruleProvider == "Custom") {
+ if ($scope.temp.policy.attributes.length == 0) {
+ $scope.temp.policy.attributes = [];
+ }
+ if ($scope.temp.policy.settings.length == 0) {
+ $scope.temp.policy.settings = [];
+ }
+ if ($scope.temp.policy.ruleAlgorithmschoices == null || $scope.temp.policy.ruleAlgorithmschoices.length == 0) {
+ $scope.temp.policy.ruleAlgorithmschoices = [];
+ }
+ } else if ($scope.temp.policy.ruleProvider == "GUARD_BL_YAML") {
+ if ($scope.temp.policy.yamlparams.blackList == null || $scope.temp.policy.yamlparams.blackList.length == 0) {
+ $scope.temp.policy.yamlparams.blackList = [];
+ }
+ if ($scope.temp.policy.blackListEntries == null || $scope.temp.policy.blackListEntries.length == 0) {
+ $scope.temp.policy.blackListEntries = [];
+ }
+ $scope.blackListEntries = [];
+ $scope.temp.policy.appendBlackListEntries = [];
+ $scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList));
+
}else if($scope.temp.policy.ruleProvider=="GUARD_YAML" || $scope.temp.policy.ruleProvider=="GUARD_MIN_MAX"){
- if($scope.temp.policy.yamlparams.targets.length==0){
- $scope.temp.policy.yamlparams.targets = [];
- }
- } else if ($scope.temp.policy.ruleProvider == "Rainy_Day") {
- if ($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0) {
- $scope.temp.policy.rainyday.treatmentTableChoices = [];
- }
- }
- $scope.attributeDatas = [ {
- "attributes" : $scope.temp.policy.attributes
- } ];
- $scope.addNewChoice = function() {
- var newItemNo = $scope.temp.policy.attributes.length + 1;
- $scope.temp.policy.attributes.push({
- 'id' : 'choice' + newItemNo
- });
- };
- $scope.removeChoice = function() {
- var lastItem = $scope.temp.policy.attributes.length - 1;
- $scope.temp.policy.attributes.splice(lastItem);
- };
-
- $scope.settingsDatas = [ {
- "settings" : $scope.temp.policy.settings
- } ];
- $scope.addNewSettingsChoice = function() {
- var newItemNo = $scope.temp.policy.settings.length + 1;
- $scope.temp.policy.settings.push({
- 'id' : 'choice' + newItemNo
- });
- };
- $scope.removeSettingsChoice = function() {
- var lastItem = $scope.temp.policy.settings.length - 1;
- $scope.temp.policy.settings.splice(lastItem);
- };
-
- $scope.addNewTarget = function() {
- $scope.temp.policy.yamlparams.targets.push('');
- };
- $scope.removeTarget = function() {
- var lastItem = $scope.temp.policy.yamlparams.targets.length - 1;
- $scope.temp.policy.yamlparams.targets.splice(lastItem);
- };
-
- $scope.addNewBL = function() {
- $scope.temp.policy.yamlparams.blackList.push('');
- };
+ if($scope.temp.policy.yamlparams.targets.length==0){
+ $scope.temp.policy.yamlparams.targets = [];
+ }
+ } else if ($scope.temp.policy.ruleProvider == "Rainy_Day") {
+ if ($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0) {
+ $scope.temp.policy.rainyday.treatmentTableChoices = [];
+ }
+ }
+ $scope.attributeDatas = [ {
+ "attributes" : $scope.temp.policy.attributes
+ } ];
+ $scope.addNewChoice = function() {
+ var newItemNo = $scope.temp.policy.attributes.length + 1;
+ $scope.temp.policy.attributes.push({
+ 'id' : 'choice' + newItemNo
+ });
+ };
+ $scope.removeChoice = function() {
+ var lastItem = $scope.temp.policy.attributes.length - 1;
+ $scope.temp.policy.attributes.splice(lastItem);
+ };
+
+ $scope.settingsDatas = [ {
+ "settings" : $scope.temp.policy.settings
+ } ];
+ $scope.addNewSettingsChoice = function() {
+ var newItemNo = $scope.temp.policy.settings.length + 1;
+ $scope.temp.policy.settings.push({
+ 'id' : 'choice' + newItemNo
+ });
+ };
+ $scope.removeSettingsChoice = function() {
+ var lastItem = $scope.temp.policy.settings.length - 1;
+ $scope.temp.policy.settings.splice(lastItem);
+ };
+
+ $scope.addNewTarget = function() {
+ $scope.temp.policy.yamlparams.targets.push('');
+ };
+ $scope.removeTarget = function() {
+ var lastItem = $scope.temp.policy.yamlparams.targets.length - 1;
+ $scope.temp.policy.yamlparams.targets.splice(lastItem);
+ };
+
+ $scope.addNewBL = function() {
+ $scope.temp.policy.yamlparams.blackList.push('');
+ };
$scope.removeBL = function(id) {
- $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function (obj){
- return obj !== id;
- });
- };
-
- $scope.treatmentDatas = [ {
- "treatmentValues" : $scope.temp.policy.rainyday.treatmentTableChoices
- } ];
-
- $scope.addNewTreatment = function() {
- $scope.temp.policy.rainyday.treatmentTableChoices.push({});
- };
-
- $scope.removeTreatment = function() {
- var lastItem = $scope.temp.policy.rainyday.treatmentTableChoices.length - 1;
- $scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem);
- };
-
- $scope.workstepDictionaryDatas = [];
- $scope.getWorkstepValues = function(bbidValue) {
- for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
- var obj = $scope.rainyDayDictionaryDataEntity[i];
- if (obj.bbid == bbidValue) {
- $scope.workstepDictionaryDatas.push(obj.workstep);
- }
- }
- };
-
- $scope.allowedTreatmentsDatas = [];
- $scope.getTreatmentValues = function(bbidValue, workstepValue) {
- for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
- var obj = $scope.rainyDayDictionaryDataEntity[i];
- if (obj.bbid == bbidValue && obj.workstep == workstepValue) {
- var splitAlarm = obj.treatments.split(',');
- for (var j = 0; j < splitAlarm.length; ++j) {
- $scope.allowedTreatmentsDatas.push(splitAlarm[j]);
- }
- }
- }
- };
-
- $scope.ItemNo = 0;
- $scope.ruleAlgorithmDatas = [ {
- "ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices
- } ];
-
- $scope.addNewRuleAlgorithm = function() {
- if ($scope.temp.policy.ruleAlgorithmschoices != null) {
- var newItemNo = $scope.temp.policy.ruleAlgorithmschoices.length + 1;
- } else {
- var newItemNo = 1;
- }
- if (newItemNo > 1) {
- var value = newItemNo - 1;
- $scope.attributeDictionaryDatas.push('A' + value);
- }
- $scope.temp.policy.ruleAlgorithmschoices.push({
- 'id' : 'A' + newItemNo
- });
- };
-
- $scope.removeRuleAlgorithm = function() {
- var lastItem = $scope.temp.policy.ruleAlgorithmschoices.length - 1;
- $scope.temp.policy.ruleAlgorithmschoices.splice(lastItem);
- };
-
- $scope.providerListener = function(ruleProvider) {
- if (ruleProvider != "Custom") {
- $scope.temp.policy.ruleAlgorithmschoices = [];
- $scope.temp.policy.settings = [];
- $scope.temp.policy.attributes = [];
- }
- if (ruleProvider === "Raw") {
- $scope.notRawPolicy = false;
- }
- };
-
- $scope.importButton = true;
- var fd;
- $scope.uploadBLFile = function(files) {
- fd = new FormData();
- fd.append("file", files[0]);
- var fileExtension = files[0].name.split(".")[1];
- if (fileExtension == "xls") {
- $scope.importButton = false;
- $scope.$apply();
- } else {
- Notification.error("Upload the BlackList file which extends with .xls format.");
- }
- };
-
- function arrayUnique(array) {
- var a = array.concat();
- for (var i = 0; i < a.length; ++i) {
- for (var j = i + 1; j < a.length; ++j) {
- if (a[i] === a[j])
- a.splice(j--, 1);
- }
- }
- return a;
- }
-
- $scope.submitUpload = function() {
- $http.post("policycreation/importBlackListForDecisionPolicy", fd, {
- withCredentials : false,
- headers : {
- 'Content-Type' : undefined
- },
- transformRequest : angular.identity
- }).success(function(data) {
- $scope.data = JSON.parse(data.data);
- $scope.temp.policy.blackListEntries = $scope.data.blackListEntries;
- if ($scope.temp.policy.blackListEntries[0] !== "error") {
- $scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList));
- $scope.temp.policy.appendBlackListEntries = $scope.data.appendBlackListEntries;
- $scope.blackListEntries = $scope.blackListEntries.filter(function(obj) {
- return !$scope.temp.policy.appendBlackListEntries.includes(obj);
- });
- if ($scope.blackListEntries.length == 0) {
- $scope.validateButton = true;
- Notification.error("Black Lists are empty. Minimum one entry required.");
- } else {
- $scope.temp.policy.blackListEntries = $scope.blackListEntries;
- Notification.success("Blacklist File Uploaded Successfully.");
- $scope.validateButton = false;
- $scope.importButton = true;
- }
- } else {
- Notification.error("Blacklist File Upload Failed." + $scope.temp.policy.blackListEntries[1]);
- }
- }).error(function(data) {
- Notification.error("Blacklist File Upload Failed.");
- });
- };
-
- $scope.initializeBlackList = function() {
- if ($scope.temp.policy.blackListEntryType === "Use File Upload") {
- $scope.validateButton = true;
- } else {
- $scope.validateButton = false;
- }
- $("#importFile").val('');
- };
-
- $scope.exportBlackListEntries = function() {
- var uuu = "policycreation/exportDecisionBlackListEntries";
- var postData = {
- policyData : $scope.temp.policy,
- date : $scope.temp.model.modifiedDate,
- version : $scope.temp.model.version
- };
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType : 'json',
- contentType : 'application/json',
- data : JSON.stringify(postData),
- success : function(data) {
- $scope.$apply(function() {
- $scope.data = data.data;
- var url = '../' + $scope.data;
- window.location = url;
- Notification.success("BlackList Entries Exported Successfully.");
- });
- console.log($scope.data);
- },
- error : function(data) {
- Notification.error("Error Occured while Exporting BlackList Entries.");
- }
- });
- };
+ $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function (obj){
+ return obj !== id;
+ });
+ };
+
+ $scope.treatmentDatas = [ {
+ "treatmentValues" : $scope.temp.policy.rainyday.treatmentTableChoices
+ } ];
+
+ $scope.addNewTreatment = function() {
+ $scope.temp.policy.rainyday.treatmentTableChoices.push({});
+ };
+
+ $scope.removeTreatment = function() {
+ var lastItem = $scope.temp.policy.rainyday.treatmentTableChoices.length - 1;
+ $scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem);
+ };
+
+ $scope.workstepDictionaryDatas = [];
+ $scope.getWorkstepValues = function(bbidValue) {
+ for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
+ var obj = $scope.rainyDayDictionaryDataEntity[i];
+ if (obj.bbid == bbidValue) {
+ $scope.workstepDictionaryDatas.push(obj.workstep);
+ }
+ }
+ };
+
+ $scope.allowedTreatmentsDatas = [];
+ $scope.getTreatmentValues = function(bbidValue, workstepValue) {
+ for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
+ var obj = $scope.rainyDayDictionaryDataEntity[i];
+ if (obj.bbid == bbidValue && obj.workstep == workstepValue) {
+ var splitAlarm = obj.treatments.split(',');
+ for (var j = 0; j < splitAlarm.length; ++j) {
+ $scope.allowedTreatmentsDatas.push(splitAlarm[j]);
+ }
+ }
+ }
+ };
+
+ $scope.ItemNo = 0;
+ $scope.ruleAlgorithmDatas = [ {
+ "ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices
+ } ];
+
+ $scope.addNewRuleAlgorithm = function() {
+ if ($scope.temp.policy.ruleAlgorithmschoices != null) {
+ var newItemNo = $scope.temp.policy.ruleAlgorithmschoices.length + 1;
+ } else {
+ var newItemNo = 1;
+ }
+ if (newItemNo > 1) {
+ var value = newItemNo - 1;
+ $scope.attributeDictionaryDatas.push('A' + value);
+ }
+ $scope.temp.policy.ruleAlgorithmschoices.push({
+ 'id' : 'A' + newItemNo
+ });
+ };
+
+ $scope.removeRuleAlgorithm = function() {
+ var lastItem = $scope.temp.policy.ruleAlgorithmschoices.length - 1;
+ $scope.temp.policy.ruleAlgorithmschoices.splice(lastItem);
+ };
+
+ $scope.providerListener = function(ruleProvider) {
+ if (ruleProvider != "Custom") {
+ $scope.temp.policy.ruleAlgorithmschoices = [];
+ $scope.temp.policy.settings = [];
+ $scope.temp.policy.attributes = [];
+ }
+ if (ruleProvider === "Raw") {
+ $scope.notRawPolicy = false;
+ }
+ };
+
+ $scope.importButton = true;
+ var fd;
+ $scope.uploadBLFile = function(files) {
+ fd = new FormData();
+ fd.append("file", files[0]);
+ var fileExtension = files[0].name.split(".")[1];
+ if (fileExtension == "xls") {
+ $scope.importButton = false;
+ $scope.$apply();
+ } else {
+ Notification.error("Upload the BlackList file which extends with .xls format.");
+ }
+ };
+
+ function arrayUnique(array) {
+ var a = array.concat();
+ for (var i = 0; i < a.length; ++i) {
+ for (var j = i + 1; j < a.length; ++j) {
+ if (a[i] === a[j])
+ a.splice(j--, 1);
+ }
+ }
+ return a;
+ }
+
+ $scope.submitUpload = function() {
+ $http.post("policycreation/importBlackListForDecisionPolicy", fd, {
+ withCredentials : false,
+ headers : {
+ 'Content-Type' : undefined
+ },
+ transformRequest : angular.identity
+ }).success(function(data) {
+ $scope.data = JSON.parse(data.data);
+ $scope.temp.policy.blackListEntries = $scope.data.blackListEntries;
+ if ($scope.temp.policy.blackListEntries[0] !== "error") {
+ $scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList));
+ $scope.temp.policy.appendBlackListEntries = $scope.data.appendBlackListEntries;
+ $scope.blackListEntries = $scope.blackListEntries.filter(function(obj) {
+ return !$scope.temp.policy.appendBlackListEntries.includes(obj);
+ });
+ if ($scope.blackListEntries.length == 0) {
+ $scope.validateButton = true;
+ Notification.error("Black Lists are empty. Minimum one entry required.");
+ } else {
+ $scope.temp.policy.blackListEntries = $scope.blackListEntries;
+ Notification.success("Blacklist File Uploaded Successfully.");
+ $scope.validateButton = false;
+ $scope.importButton = true;
+ }
+ } else {
+ Notification.error("Blacklist File Upload Failed." + $scope.temp.policy.blackListEntries[1]);
+ }
+ }).error(function(data) {
+ Notification.error("Blacklist File Upload Failed.");
+ });
+ };
+
+ $scope.initializeBlackList = function() {
+ if ($scope.temp.policy.blackListEntryType === "Use File Upload") {
+ $scope.validateButton = true;
+ } else {
+ $scope.validateButton = false;
+ }
+ $("#importFile").val('');
+ };
+
+ $scope.exportBlackListEntries = function() {
+ var uuu = "policycreation/exportDecisionBlackListEntries";
+ var postData = {
+ policyData : $scope.temp.policy,
+ date : $scope.temp.model.modifiedDate,
+ version : $scope.temp.model.version
+ };
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType : 'json',
+ contentType : 'application/json',
+ data : JSON.stringify(postData),
+ success : function(data) {
+ $scope.$apply(function() {
+ $scope.data = data.data;
+ var url = '../' + $scope.data;
+ window.location = url;
+ Notification.success("BlackList Entries Exported Successfully.");
+ });
+ },
+ error : function(data) {
+ Notification.error("Error Occured while Exporting BlackList Entries.");
+ }
+ });
+ };
} ]);
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
index 1d39c4f4a..b62f91d0d 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
@@ -17,7 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
+angular.module('abs').controller('fwPolicyController',
+ ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification',
+ function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
$("#dialog").hide();
$scope.policyNavigator;
@@ -25,18 +27,18 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po
$scope.refreshCheck = false;
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
- $scope.temp.policy = {
- policyType : "Config",
- configPolicyType : "Firewall Config"
- }
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "Firewall Config"
+ }
};
$scope.refresh = function(){
- if($scope.refreshCheck){
- $scope.policyNavigator.refresh();
- }
- $scope.modal('createNewPolicy', true);
- $scope.temp.policy = "";
+ if($scope.refreshCheck){
+ $scope.policyNavigator.refresh();
+ }
+ $scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
@@ -44,76 +46,51 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po
};
$('#ttlDate').datepicker({
- dateFormat: 'dd/mm/yy',
- changeMonth: true,
- changeYear: true,
- onSelect: function(date) {
- angular.element($('#ttlDate')).triggerHandler('input');
- }
+ dateFormat: 'dd/mm/yy',
+ changeMonth: true,
+ changeYear: true,
+ onSelect: function(date) {
+ angular.element($('#ttlDate')).triggerHandler('input');
+ }
});
-
+
PolicyAppService.getData('getDictionary/get_SecurityZoneDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.securityZoneDictionaryDatas = JSON.parse($scope.data.securityZoneDictionaryDatas);
- console.log($scope.securityZoneDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.securityZoneDictionaryDatas = JSON.parse($scope.data.securityZoneDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_TermListDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.termListDictionaryDatas = JSON.parse($scope.data.termListDictionaryDatas);
- console.log($scope.termListDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.termListDictionaryDatas = JSON.parse($scope.data.termListDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_FWDictionaryListDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.fwDictListDictionaryDatas = JSON.parse($scope.data.fwDictListDictionaryDatas);
- console.log($scope.fwDictListDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.fwDictListDictionaryDatas = JSON.parse($scope.data.fwDictListDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_FWParentListDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.fwParentListDictionaryDatas = JSON.parse($scope.data.fwParentListDictionaryDatas);
- console.log($scope.fwParentListDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.fwParentListDictionaryDatas = JSON.parse($scope.data.fwParentListDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_TagPickerNameByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.fwTagPickerDictionaryDatas = JSON.parse($scope.data.fwTagPickerDictionaryDatas);
- console.log($scope.fwTagPickerDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.fwTagPickerDictionaryDatas = JSON.parse($scope.data.fwTagPickerDictionaryDatas);
});
PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
});
$scope.viewFWRule = function(policy){
- console.log(policy);
var uuu = "policyController/ViewFWPolicyRule.htm";
var postData={policyData: policy};
$.ajax({
@@ -124,110 +101,106 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po
data: JSON.stringify(postData),
success : function(data){
$scope.$apply(function(){
- window.alert(data.policyData);
+ window.alert(data.policyData);
});
},
error : function(data){
- Notification.error("Error Occured while Showing Rule.");
+ Notification.error("Error Occured while Showing Rule.");
}
});
};
$scope.saveFWPolicy = function(policy){
- if(policy.itemContent != undefined){
- $scope.refreshCheck = true;
- $scope.policyNavigator = policy.itemContent;
- policy.itemContent = "";
- }
- $scope.savebutton = false;
- console.log(policy);
+ if(policy.itemContent != undefined){
+ $scope.refreshCheck = true;
+ $scope.policyNavigator = policy.itemContent;
+ policy.itemContent = "";
+ }
+ $scope.savebutton = false;
var uuu = "policycreation/save_policy";
- var postData={policyData: policy};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.data=data.policyData;
- if($scope.data == 'success'){
- $scope.temp.policy.readOnly = 'true';
- $scope.pushStatus=data.policyData.split("&")[1];
- if($scope.pushStatus=="successPush"){
- Notification.success("Policy pushed successfully");
- }
- Notification.success("Policy Saved Successfully.");
- }else if ($scope.data == 'PolicyExists'){
- $scope.savebutton = true;
- Notification.error("Policy Already Exists with Same Name in Scope.");
- }
- });
- console.log($scope.data);
- },
- error : function(data){
- Notification.error("Error Occured while saving Policy.");
- }
- });
+ var postData={policyData: policy};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.data=data.policyData;
+ if($scope.data == 'success'){
+ $scope.temp.policy.readOnly = 'true';
+ $scope.pushStatus=data.policyData.split("&")[1];
+ if($scope.pushStatus=="successPush"){
+ Notification.success("Policy pushed successfully");
+ }
+ Notification.success("Policy Saved Successfully.");
+ }else if ($scope.data == 'PolicyExists'){
+ $scope.savebutton = true;
+ Notification.error("Policy Already Exists with Same Name in Scope.");
+ }
+ });
+ },
+ error : function(data){
+ Notification.error("Error Occured while saving Policy.");
+ }
+ });
};
$scope.validatePolicy = function(policy){
- console.log(policy);
- document.getElementById("validate").innerHTML = "";
+ document.getElementById("validate").innerHTML = "";
var uuu = "policyController/validate_policy.htm";
- var postData={policyData: policy};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- $scope.validateData = data.data.replace(/\"/g, "");
- $scope.data=data.data.substring(1,8);
- var size = data.data.length;
- if($scope.data == 'success'){
- Notification.success("Validation Success.");
- $scope.savebutton = false;
- if (size > 18){
- var displayWarning = data.data.substring(19,size);
- document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "skyblue";
- }
- }else{
- Notification.error("Validation Failed.");
- document.getElementById("validate").innerHTML = $scope.validateData;
- document.getElementById("validate").style.color = "white";
- document.getElementById("validate").style.backgroundColor = "red";
- $scope.savebutton = true;
- }
-
- });
- console.log($scope.data);
-
- },
- error : function(data){
- Notification.error("Validation Failed.");
- $scope.savebutton = true;
- }
- });
+ var postData={policyData: policy};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.validateData = data.data.replace(/\"/g, "");
+ $scope.data=data.data.substring(1,8);
+ var size = data.data.length;
+ if($scope.data == 'success'){
+ Notification.success("Validation Success.");
+ $scope.savebutton = false;
+ if (size > 18){
+ var displayWarning = data.data.substring(19,size);
+ document.getElementById("validate").innerHTML = "Safe Policy Warning Message : "+displayWarning;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "skyblue";
+ }
+ }else{
+ Notification.error("Validation Failed.");
+ document.getElementById("validate").innerHTML = $scope.validateData;
+ document.getElementById("validate").style.color = "white";
+ document.getElementById("validate").style.backgroundColor = "red";
+ $scope.savebutton = true;
+ }
+
+ });
+
+ },
+ error : function(data){
+ Notification.error("Validation Failed.");
+ $scope.savebutton = true;
+ }
+ });
};
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
- $scope.temp.policy.attributes = [];
- $scope.temp.policy.fwattributes = [];
+ $scope.temp.policy.attributes = [];
+ $scope.temp.policy.fwattributes = [];
}else{
if($scope.temp.policy.attributes.length == 0){
- $scope.temp.policy.attributes = [];
+ $scope.temp.policy.attributes = [];
}
if($scope.temp.policy.fwPolicyType == 'Parent Policy'){
- if($scope.temp.policy.fwattributes.length == 0){
- $scope.temp.policy.fwattributes = [];
- }
+ if($scope.temp.policy.fwattributes.length == 0){
+ $scope.temp.policy.fwattributes = [];
+ }
}
}
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/OptimizationPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/OptimizationPolicyController.js
index 272792518..58594bc43 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/OptimizationPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/OptimizationPolicyController.js
@@ -68,27 +68,18 @@ angular.module('abs').controller('optimizationController',
PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- console.log($scope.onapNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('get_DCAEPriorityValues').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.priorityDatas = JSON.parse($scope.data.priorityDatas);
- console.log($scope.priorityDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_OptimizationModelsDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
var inputModelList = JSON.parse($scope.data.optimizationModelsDictionaryDatas);
var unique = {};
var uniqueList = [];
@@ -99,26 +90,18 @@ angular.module('abs').controller('optimizationController',
}
}
$scope.optimizationModelsDictionaryDatas = uniqueList;
- console.log($scope.optimizationModelsDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
PolicyAppService.getData('getDictionary/get_RiskTypeDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
- console.log($scope.data);
$scope.riskTypeDictionaryDatas = JSON.parse($scope.data.riskTypeDictionaryDatas);
- console.log($scope.riskTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
});
$scope.choices = [];
$scope.attributeDatas = [{"attributes" : $scope.choices}];
$scope.isInitEditTemplate = true; //just initially create the edit template, didn't click add button yet.
$scope.addNewChoice = function(value) {
- console.log("input value : " + value);
if(value != undefined){
if (value.startsWith('div.')){
value = value.replace('div.','');
@@ -237,7 +220,6 @@ angular.module('abs').controller('optimizationController',
}
$scope.removeChoice = function(value) {
- console.log(value);
if(value != undefined){
var c = document.getElementById("div."+value).childElementCount;
@@ -250,7 +232,6 @@ angular.module('abs').controller('optimizationController',
};
$scope.pullVersion = function(serviceName) {
- console.log(serviceName);
if(serviceName != undefined){
var uuu = "policyController/getModelServiceVersionData.htm";
var postData={policyData: serviceName};
@@ -301,20 +282,6 @@ angular.module('abs').controller('optimizationController',
$scope.optimizationModelData = data[0].optimizationModelData;
$scope.optimizationJsonDate = data[0].jsonValue;
$scope.dataOrderInfo = null;
- $scope.dataOrderInfo = data[0].dataOrderInfo;
- console.log("data[0].dataOrderInfo: " + data[0].dataOrderInfo);
- console.log("$scope.dataOrderInfo: " + $scope.dataOrderInfo);
- if(data[0].allManyTrueKeys){
- console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys);
- }
- console.log("$scope.optimizationJsonDate: " + $scope.optimizationJsonDate);
- var attributes = $scope.optimizationModelData.attributes;
- var refAttributes = $scope.optimizationModelData.ref_attributes;
- var subAttributes = $scope.optimizationModelData.sub_attributes;
- console.log("attributes: " +attributes);
- console.log("subAttributes: " + subAttributes);
- console.log("refAttributes: " + refAttributes);
-
var headDefautlsData = data[0].headDefautlsData;
if(headDefautlsData != null){
$scope.temp.policy.onapName = headDefautlsData.onapName;
@@ -357,7 +324,6 @@ angular.module('abs').controller('optimizationController',
conpairService = service;
}
if(valueModel.localeCompare(conpairService) == 0){
- console.log(valueCompare);
dictionaryList.push(dictionary[m]);
if (!dictionaryNameList.includes(dictionary[m].name)){
dictionaryNameList.push(dictionary[m].name)
@@ -413,7 +379,6 @@ angular.module('abs').controller('optimizationController',
var n = getNumOfDigits(extraElements[a], index+1);
var key = extraElements[a].substring(0, index+n+1); //include @x in key also by n+2 since x can be 1,12, etc
- console.log("key: " + key);
checkData.push(key);
}
}
@@ -426,13 +391,11 @@ angular.module('abs').controller('optimizationController',
//var newKey = unique[i].substring(0, unique[i].length-2);
var index = unique[i].lastIndexOf("@");
var newKey = unique[i].substring(0, index);
- console.log("newKey: " + newKey);
$scope.addNewChoice(newKey);
}
}else{
for (i = 0; i < $scope.labelManyKeys.length; i++) {
- console.log("dataOrderInfo["+i+"]"+ dataOrderInfo[i]);
var label = $scope.labelManyKeys[i];
// first add parent/label level
for (k = 0; k < unique.length; k++){
@@ -521,7 +484,6 @@ angular.module('abs').controller('optimizationController',
function getList(attribute) {
var enumName = attribute;
- console.log("In getList: attribute => " + attribute);
if(attribute){
if(attribute.includes(":")){
enumName = attribute.split(":")[0];
@@ -592,7 +554,6 @@ angular.module('abs').controller('optimizationController',
for (key in layOutData) {
array = isArray(layOutData[key]);
- console.log("key: " + key , "value: " + layOutData[key]);
if (!!layOutData[key] && typeof(layOutData[key])=="object") {
@@ -666,7 +627,6 @@ angular.module('abs').controller('optimizationController',
if(allkeys){
for (var k = 0; k < allkeys.length; k++) {
var keyValue = allkeys[k];
- console.log(" keyValue:jsonObject["+keyValue+ "]: " + jsonObject[keyValue]);
if(jsonObject[keyValue]){
var tempObject = jsonObject[keyValue];
if(tempObject && tempObject[key]){
@@ -752,14 +712,11 @@ angular.module('abs').controller('optimizationController',
}
$scope.validContionalRequired = function(parentId) {
- console.log("ng-blur event: parentId : " + parentId);
var c = document.getElementById(parentId).children;
var i;
var hasValue = false;
for (i = 0; i < c.length; i++) {
if(c[i].getAttribute("data-conditional")){
- console.log(c[i].getAttribute("data-conditional"));
- console.log(c[i].value);
if(c[i].value != null && c[i].value.trim() != ""){
hasValue = true;
}
@@ -801,7 +758,6 @@ angular.module('abs').controller('optimizationController',
orderValue = orderValue.split(',') ;
for (i = 0; i < orderValue.length; i++) {
- console.log("orderValue["+i+"]"+ orderValue[i]);
var key = orderValue[i].trim();
//--- Create labels first {"label" : newKey, "level" : baseLevel, "array" : array};
@@ -831,7 +787,6 @@ angular.module('abs').controller('optimizationController',
var defaultValue = layOutElementList[j].defaultValue.toString().trim();
var isRequired = layOutElementList[j].isRequired;
- console.log("layOutElementList[" +j+ "]: id:" + layOutElementList[j].id + ", attributekey:"+ layOutElementList[j].attributekey + ", attirbuteLabel:" + layOutElementList[j].attirbuteLabel);
if (layOutElementList[j].type == "dropBox"){
$scope.dropBoxLayout(attirbuteLabel, attributekey, layOutElementList[j].array, defaultValue, layOutElementList[j].list, isRequired);
@@ -966,8 +921,6 @@ angular.module('abs').controller('optimizationController',
firstChild_element.className += ' children_group'; //here is a div with a group of children.
}
}
- console.log('firstChild_Id: ' + firstChild_Id);
- console.log('divID: ' + divID);
if (defaultValue.length > 0){
if(defaultValue.includes(":")){
@@ -1016,7 +969,6 @@ angular.module('abs').controller('optimizationController',
var subAttributes = $scope.optimizationModelData.subattributes;
var jsonObject = JSON.parse(subAttributes);
var lablInfo = findVal(jsonObject, lableName);
- console.log("findValue : " + lableName +": "+ lablInfo);
var star = "";
var required = null;
if(lablInfo){
@@ -1218,7 +1170,6 @@ angular.module('abs').controller('optimizationController',
if(plainAttributeKeys != null){
for(a = 0; a < plainAttributeKeys.length; a++){
var splitPlainAttributeKey = plainAttributeKeys[a].split(splitAt);
- console.log("splitPlainAttributeKey: " + splitPlainAttributeKey);
var searchElement = document.getElementById(splitPlainAttributeKey[0]);
var key = splitPlainAttributeKey[0];
@@ -1243,12 +1194,10 @@ angular.module('abs').controller('optimizationController',
}
jsonPolicy[key]= multiSlect;
}else{
- console.log(" searchElement.value = > " + searchElement.value);
jsonPolicy[key]= searchElement.value;
}
} else {
if(searchElement.value != null){
- console.log(" searchElement.value = > " + searchElement.value);
jsonPolicy[key]= searchElement.value;
}
}
@@ -1282,7 +1231,6 @@ angular.module('abs').controller('optimizationController',
Notification.error("Policy Already Exists with Same Name in Scope.");
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Error Occured while saving Policy.");
@@ -1298,7 +1246,6 @@ angular.module('abs').controller('optimizationController',
if(plainAttributeKeys != null){
for(a = 0; a < plainAttributeKeys.length; a++){
var splitPlainAttributeKey = plainAttributeKeys[a].split(splitAt);
- console.log(splitPlainAttributeKey[1]);
var searchElement = document.getElementById(splitPlainAttributeKey[0]);
var key = splitPlainAttributeKey[0];
if(searchElement == null || searchElement.nodeName == 'BUTTON'){
@@ -1365,7 +1312,6 @@ angular.module('abs').controller('optimizationController',
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Validation Failed.");
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policyManager.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policyManager.js
index 3a926c485..c4ec75ce1 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policyManager.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policyManager.js
@@ -18,326 +18,307 @@
* ============LICENSE_END=========================================================
*/
app.controller('PolicyManagerController', [
- '$scope', '$q', '$window', '$cookies', 'policyManagerConfig', 'item', 'policyNavigator', 'policyUploader', 'Notification','PolicyAppService',
- function($scope, $q, $Window, $cookies, policyManagerConfig, Item, PolicyNavigator, PolicyUploader, Notification, PolicyAppService ) {
+ '$scope', '$q', '$window', '$cookies', 'policyManagerConfig', 'item', 'policyNavigator', 'policyUploader', 'Notification','PolicyAppService',
+ function($scope, $q, $Window, $cookies, policyManagerConfig, Item, PolicyNavigator, PolicyUploader, Notification, PolicyAppService ) {
- $scope.isDisabled = true;
- $scope.superAdminId = false;
- $scope.exportPolicyId = false;
- $scope.importPolicyId = false;
- $scope.createScopeId = false;
- $scope.deleteScopeId = false;
- $scope.renameId = false;
- $scope.createPolicyId = false;
- $scope.cloneId = false;
- $scope.editPolicyId = false;
- $scope.switchVersionId = false;
- $scope.describePolicyId = false;
- $scope.viewPolicyId = false;
- $scope.deletePolicyId = false;
- PolicyAppService.getData('get_LockDownData').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
- if ($scope.lockdowndata[0].lockdown == true) {
- $scope.isDisabled = true;
- } else {
- $scope.isDisabled = false;
- }
- console.log($scope.data);
- }, function(error) {
- console.log("failed");
- });
+ $scope.isDisabled = true;
+ $scope.superAdminId = false;
+ $scope.exportPolicyId = false;
+ $scope.importPolicyId = false;
+ $scope.createScopeId = false;
+ $scope.deleteScopeId = false;
+ $scope.renameId = false;
+ $scope.createPolicyId = false;
+ $scope.cloneId = false;
+ $scope.editPolicyId = false;
+ $scope.switchVersionId = false;
+ $scope.describePolicyId = false;
+ $scope.viewPolicyId = false;
+ $scope.deletePolicyId = false;
+ PolicyAppService.getData('get_LockDownData').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
+ if ($scope.lockdowndata[0].lockdown == true) {
+ $scope.isDisabled = true;
+ } else {
+ $scope.isDisabled = false;
+ }
+ }, function(error) {
+ });
- PolicyAppService.getData('getDictionary/get_DescriptiveScopeByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_DescriptiveScopeByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function(data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function(data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
+ });
- PolicyAppService.getData('get_UserRolesData').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas);
- console.log($scope.userRolesDatas);
- if ($scope.userRolesDatas[0] == 'super-admin') {
- $scope.superAdminId = true;
- $scope.exportPolicyId = true;
- $scope.importPolicyId = true;
- } else if ($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor' || $scope.userRolesDatas[0] == 'admin') {
- $scope.exportPolicyId = true;
- $scope.importPolicyId = true;
- }
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('get_UserRolesData').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas);
+ if ($scope.userRolesDatas[0] == 'super-admin') {
+ $scope.superAdminId = true;
+ $scope.exportPolicyId = true;
+ $scope.importPolicyId = true;
+ } else if ($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor' || $scope.userRolesDatas[0] == 'admin') {
+ $scope.exportPolicyId = true;
+ $scope.importPolicyId = true;
+ }
+ });
- $scope.config = policyManagerConfig;
- $scope.reverse = false;
- $scope.predicate = ['model.type', 'model.name'];
- $scope.order = function(predicate) {
- $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false;
- $scope.predicate[1] = predicate;
- };
+ $scope.config = policyManagerConfig;
+ $scope.reverse = false;
+ $scope.predicate = ['model.type', 'model.name'];
+ $scope.order = function(predicate) {
+ $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false;
+ $scope.predicate[1] = predicate;
+ };
- $scope.query = '';
- $scope.temp = new Item();
- $scope.policyNavigator = new PolicyNavigator();
- $scope.policyUploader = PolicyUploader;
- $scope.uploadFileList = [];
+ $scope.query = '';
+ $scope.temp = new Item();
+ $scope.policyNavigator = new PolicyNavigator();
+ $scope.policyUploader = PolicyUploader;
+ $scope.uploadFileList = [];
- $scope.setTemplate = function(name) {
- $scope.viewTemplate = $cookies.viewTemplate = name;
- };
+ $scope.setTemplate = function(name) {
+ $scope.viewTemplate = $cookies.viewTemplate = name;
+ };
- $scope.touch = function(item) {
- item = item instanceof Item ? item : new Item();
- item.revert();
- $scope.temp = item;
- $scope.createScopeId = false;
- $scope.deleteScopeId = false;
- $scope.renameId = false;
- $scope.createPolicyId = false;
- $scope.cloneId = false;
- $scope.editPolicyId = false;
- $scope.switchVersionId = false;
- $scope.describePolicyId = false;
- $scope.viewPolicyId = false;
- $scope.deletePolicyId = false;
- if ($scope.temp.model.roleType == 'super-admin') {
- $scope.createScopeId = true;
- $scope.deleteScopeId = true;
- $scope.renameId = true;
- $scope.createPolicyId = true;
- $scope.cloneId = true;
- $scope.editPolicyId = true;
- $scope.switchVersionId = true;
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- $scope.deletePolicyId = true;
- } else if ($scope.temp.model.roleType == 'super-editor' || $scope.temp.model.roleType == 'editor') {
- $scope.cloneId = true;
- $scope.editPolicyId = true;
- $scope.createPolicyId = true;
- $scope.switchVersionId = true;
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- $scope.deletePolicyId = true;
- } else if ($scope.temp.model.roleType == 'super-guest' || $scope.temp.model.roleType == 'guest') {
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- } else if ($scope.temp.model.roleType == 'admin') {
- $scope.createScopeId = true;
- $scope.renameId = true;
- $scope.createPolicyId = true;
- $scope.cloneId = true;
- $scope.editPolicyId = true;
- $scope.switchVersionId = true;
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- $scope.deletePolicyId = true;
- }
- };
+ $scope.touch = function(item) {
+ item = item instanceof Item ? item : new Item();
+ item.revert();
+ $scope.temp = item;
+ $scope.createScopeId = false;
+ $scope.deleteScopeId = false;
+ $scope.renameId = false;
+ $scope.createPolicyId = false;
+ $scope.cloneId = false;
+ $scope.editPolicyId = false;
+ $scope.switchVersionId = false;
+ $scope.describePolicyId = false;
+ $scope.viewPolicyId = false;
+ $scope.deletePolicyId = false;
+ if ($scope.temp.model.roleType == 'super-admin') {
+ $scope.createScopeId = true;
+ $scope.deleteScopeId = true;
+ $scope.renameId = true;
+ $scope.createPolicyId = true;
+ $scope.cloneId = true;
+ $scope.editPolicyId = true;
+ $scope.switchVersionId = true;
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ $scope.deletePolicyId = true;
+ } else if ($scope.temp.model.roleType == 'super-editor' || $scope.temp.model.roleType == 'editor') {
+ $scope.cloneId = true;
+ $scope.editPolicyId = true;
+ $scope.createPolicyId = true;
+ $scope.switchVersionId = true;
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ $scope.deletePolicyId = true;
+ } else if ($scope.temp.model.roleType == 'super-guest' || $scope.temp.model.roleType == 'guest') {
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ } else if ($scope.temp.model.roleType == 'admin') {
+ $scope.createScopeId = true;
+ $scope.renameId = true;
+ $scope.createPolicyId = true;
+ $scope.cloneId = true;
+ $scope.editPolicyId = true;
+ $scope.switchVersionId = true;
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ $scope.deletePolicyId = true;
+ }
+ };
- $scope.smartClick = function(item) {
- if (item.isFolder()) {
- return $scope.policyNavigator.folderClick(item);
- }
- if (item.isEditable()) {
- return $scope.openEditItem(item);
- }
- };
+ $scope.smartClick = function(item) {
+ if (item.isFolder()) {
+ return $scope.policyNavigator.folderClick(item);
+ }
+ if (item.isEditable()) {
+ return $scope.openEditItem(item);
+ }
+ };
- $scope.openEditItem = function(item) {
- item.getContent();
- $scope.modal('createNewPolicy');
- return $scope.touch(item);
- };
+ $scope.openEditItem = function(item) {
+ item.getContent();
+ $scope.modal('createNewPolicy');
+ return $scope.touch(item);
+ };
- $scope.modal = function(id, hide) {
- return $('#' + id).modal(hide ? 'hide' : 'show');
- };
+ $scope.modal = function(id, hide) {
+ return $('#' + id).modal(hide ? 'hide' : 'show');
+ };
- $scope.isInThisPath = function(path) {
- var currentPath = $scope.policyNavigator.currentPath.join('/');
- return currentPath.indexOf(path) !== -1;
- };
-
+ $scope.isInThisPath = function(path) {
+ var currentPath = $scope.policyNavigator.currentPath.join('/');
+ return currentPath.indexOf(path) !== -1;
+ };
+
$scope.watchPolicy = function(item) {
- var uuu = "watchPolicy";
- var data = {name : item.model.name,
- path : item.model.path};
- var postData={watchData: data};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data) {
- $scope.$apply(function() {
- $scope.watchData=data.watchData;});
- Notification.success($scope.watchData);
- console.log($scope.watchData);
- },
- error : function(data) {
- Notification.error("Error while saving.");
- }
- });
+ var uuu = "watchPolicy";
+ var data = {name : item.model.name,
+ path : item.model.path};
+ var postData={watchData: data};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data) {
+ $scope.$apply(function() {
+ $scope.watchData=data.watchData;});
+ Notification.success($scope.watchData);
+ },
+ error : function(data) {
+ Notification.error("Error while saving.");
+ }
+ });
};
$scope.refresh = function() {
- $scope.policyNavigator.refresh();
+ $scope.policyNavigator.refresh();
};
- $scope.switchVersion = function(item) {
- if ($scope.policyNavigator.fileNameExists(item.tempModel.content.activeVersion)) {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- item.getSwitchVersionContent().then(function(){
- $scope.policyNavigator.refresh();
- $scope.modal('switchVersion', true);
- });
- };
+ $scope.switchVersion = function(item) {
+ if ($scope.policyNavigator.fileNameExists(item.tempModel.content.activeVersion)) {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ item.getSwitchVersionContent().then(function(){
+ $scope.policyNavigator.refresh();
+ $scope.modal('switchVersion', true);
+ });
+ };
- $scope.copy = function(item) {
- var samePath = item.tempModel.path.join() === item.model.path.join();
- if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- item.copy().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('copy', true);
- });
- };
+ $scope.copy = function(item) {
+ var samePath = item.tempModel.path.join() === item.model.path.join();
+ if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ item.copy().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('copy', true);
+ });
+ };
- $scope.remove = function(item) {
- item.remove().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('delete', true);
- });
- };
+ $scope.remove = function(item) {
+ item.remove().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('delete', true);
+ });
+ };
- $scope.removePolicy = function(item) {
- item.removePolicy().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('deletePolicy', true);
- });
- };
+ $scope.removePolicy = function(item) {
+ item.removePolicy().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('deletePolicy', true);
+ });
+ };
- $scope.rename = function(item) {
- var samePath = item.tempModel.path.join() === item.model.path.join();
- if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- item.rename().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('rename', true);
- });
- };
+ $scope.rename = function(item) {
+ var samePath = item.tempModel.path.join() === item.model.path.join();
+ if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ item.rename().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('rename', true);
+ });
+ };
- $scope.move = function(item) {
- var samePath = item.tempModel.path.join() === item.model.path.join();
- if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- item.move().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('move', true);
- });
- };
+ $scope.move = function(item) {
+ var samePath = item.tempModel.path.join() === item.model.path.join();
+ if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ item.move().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('move', true);
+ });
+ };
- $scope.createFolder = function(item) {
- var name = item.tempModel.name && item.tempModel.name.trim();
- item.tempModel.type = 'dir';
- item.tempModel.path = $scope.policyNavigator.currentPath;
- if (name && !$scope.policyNavigator.fileNameExists(name)) {
- item.createFolder().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('newfolder', true);
- });
- } else {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- };
+ $scope.createFolder = function(item) {
+ var name = item.tempModel.name && item.tempModel.name.trim();
+ item.tempModel.type = 'dir';
+ item.tempModel.path = $scope.policyNavigator.currentPath;
+ if (name && !$scope.policyNavigator.fileNameExists(name)) {
+ item.createFolder().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('newfolder', true);
+ });
+ } else {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ };
- $scope.subScopeFolder = function(item) {
- var name = item.tempModel.name +"\\" + item.tempModel.subScopename && item.tempModel.name.trim() + "\\"+item.tempModel.subScopename.trim() ;
- item.tempModel.type = 'dir';
- item.tempModel.path = $scope.policyNavigator.currentPath;
- if (name && !$scope.policyNavigator.fileNameExists(name)) {
- item.getScopeContent().then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('addSubScope', true);
- });
- } else {
- item.error = 'Invalid filename or already exists, specify another name';
- return false;
- }
- };
+ $scope.subScopeFolder = function(item) {
+ var name = item.tempModel.name +"\\" + item.tempModel.subScopename && item.tempModel.name.trim() + "\\"+item.tempModel.subScopename.trim() ;
+ item.tempModel.type = 'dir';
+ item.tempModel.path = $scope.policyNavigator.currentPath;
+ if (name && !$scope.policyNavigator.fileNameExists(name)) {
+ item.getScopeContent().then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('addSubScope', true);
+ });
+ } else {
+ item.error = 'Invalid filename or already exists, specify another name';
+ return false;
+ }
+ };
- $scope.closefunction = function(fianlPath) {
- $scope.policyNavigator.policyrefresh(fianlPath);
- };
+ $scope.closefunction = function(fianlPath) {
+ $scope.policyNavigator.policyrefresh(fianlPath);
+ };
- $scope.uploadFiles = function() {
- $scope.policyUploader.upload($scope.uploadFileList, $scope.policyNavigator.currentPath).then(function() {
- $scope.policyNavigator.refresh();
- $scope.modal('uploadfile', true);
- }, function(data) {
- var errorMsg = data.result && data.result.error || 'Error Occured while Uploading....';
- $scope.temp.error = errorMsg;
- });
- };
+ $scope.uploadFiles = function() {
+ $scope.policyUploader.upload($scope.uploadFileList, $scope.policyNavigator.currentPath).then(function() {
+ $scope.policyNavigator.refresh();
+ $scope.modal('uploadfile', true);
+ }, function(data) {
+ var errorMsg = data.result && data.result.error || 'Error Occured while Uploading....';
+ $scope.temp.error = errorMsg;
+ });
+ };
- $scope.getQueryParam = function(param) {
- var found;
- window.location.search.substr(1).split('&').forEach(function(item) {
- if (param === item.split('=')[0]) {
- found = item.split('=')[1];
- return false;
- }
- });
- return found;
- };
+ $scope.getQueryParam = function(param) {
+ var found;
+ window.location.search.substr(1).split('&').forEach(function(item) {
+ if (param === item.split('=')[0]) {
+ found = item.split('=')[1];
+ return false;
+ }
+ });
+ return found;
+ };
- $scope.isWindows = $scope.getQueryParam('server') === 'Windows';
- $scope.policyNavigator.refresh();
+ $scope.isWindows = $scope.getQueryParam('server') === 'Windows';
+ $scope.policyNavigator.refresh();
}]);
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js
index 42e6796cd..edca7e47c 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,194 +18,176 @@
* ============LICENSE_END=========================================================
*/
app.controller('PolicySearchController', [
- '$scope', '$q', '$window', '$cookies', 'policyManagerConfig', 'item', 'policyNavigator', 'policyUploader', 'Notification','PolicyAppService',
- function($scope, $q, $Window, $cookies, policyManagerConfig, Item, PolicyNavigator, PolicyUploader, Notification, PolicyAppService ) {
-
- $scope.isDisabled = true;
- $scope.superAdminId = false;
- $scope.exportPolicyId = false;
- $scope.importPolicyId = false;
- $scope.createScopeId = false;
- $scope.deleteScopeId = false;
- $scope.renameId = false;
- $scope.createPolicyId = false;
- $scope.cloneId = false;
- $scope.editPolicyId = false;
- $scope.switchVersionId = false;
- $scope.describePolicyId = false;
- $scope.viewPolicyId = false;
- $scope.deletePolicyId = false;
- PolicyAppService.getData('get_LockDownData').then(function(data){
- var j = data;
- $scope.data = JSON.parse(j.data);
- $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
- if($scope.lockdowndata[0].lockdown == true){
- $scope.isDisabled = true;
- }else{
- $scope.isDisabled = false;
- }
- console.log($scope.data);
- },function(error){
- console.log("failed");
- });
+ '$scope', '$q', '$window', '$cookies', 'policyManagerConfig', 'item', 'policyNavigator', 'policyUploader', 'Notification','PolicyAppService',
+ function($scope, $q, $Window, $cookies, policyManagerConfig, Item, PolicyNavigator, PolicyUploader, Notification, PolicyAppService ) {
- PolicyAppService.getData('getDictionary/get_DescriptiveScopeByName').then(function(data){
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ $scope.isDisabled = true;
+ $scope.superAdminId = false;
+ $scope.exportPolicyId = false;
+ $scope.importPolicyId = false;
+ $scope.createScopeId = false;
+ $scope.deleteScopeId = false;
+ $scope.renameId = false;
+ $scope.createPolicyId = false;
+ $scope.cloneId = false;
+ $scope.editPolicyId = false;
+ $scope.switchVersionId = false;
+ $scope.describePolicyId = false;
+ $scope.viewPolicyId = false;
+ $scope.deletePolicyId = false;
+ PolicyAppService.getData('get_LockDownData').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
+ if($scope.lockdowndata[0].lockdown == true){
+ $scope.isDisabled = true;
+ }else{
+ $scope.isDisabled = false;
+ }
+ },function(error){
+ });
+
+ PolicyAppService.getData('getDictionary/get_DescriptiveScopeByName').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.descriptiveScopeDictionaryDatas = JSON.parse($scope.data.descriptiveScopeDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data){
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function(data){
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VSCLActionDataByName').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vsclActionDictionaryDatas = JSON.parse($scope.data.vsclActionDictionaryDatas);
+ });
- PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function(data){
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
- }, function (error) {
- console.log("failed");
- });
+ PolicyAppService.getData('getDictionary/get_VNFTypeDataByName').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.vnfTypeDictionaryDatas = JSON.parse($scope.data.vnfTypeDictionaryDatas);
+ });
-
- PolicyAppService.getData('get_UserRolesData').then(function (data) {
- var j = data;
- $scope.data = JSON.parse(j.data);
- console.log($scope.data);
- $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas);
- console.log($scope.userRolesDatas);
- if($scope.userRolesDatas[0] == 'super-admin'){
- $scope.superAdminId = true;
- $scope.createPolicyId = true;
- $scope.editPolicyId = true;
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- }else if($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor' || $scope.userRolesDatas[0] == 'admin'){
- $scope.editPolicyId = true;
- $scope.createPolicyId = true;
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- }else if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){
- $scope.describePolicyId = true;
- $scope.viewPolicyId = true;
- }
- }, function (error) {
- console.log("failed");
- });
-
- $scope.config = policyManagerConfig;
- $scope.reverse = false;
- $scope.predicate = ['model.type', 'model.name'];
- $scope.order = function(predicate) {
- $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false;
- $scope.predicate[1] = predicate;
- };
+
+ PolicyAppService.getData('get_UserRolesData').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.userRolesDatas = JSON.parse($scope.data.userRolesDatas);
+ if($scope.userRolesDatas[0] == 'super-admin'){
+ $scope.superAdminId = true;
+ $scope.createPolicyId = true;
+ $scope.editPolicyId = true;
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ }else if($scope.userRolesDatas[0] == 'super-editor' || $scope.userRolesDatas[0] == 'editor' || $scope.userRolesDatas[0] == 'admin'){
+ $scope.editPolicyId = true;
+ $scope.createPolicyId = true;
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ }else if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){
+ $scope.describePolicyId = true;
+ $scope.viewPolicyId = true;
+ }
+ });
+
+ $scope.config = policyManagerConfig;
+ $scope.reverse = false;
+ $scope.predicate = ['model.type', 'model.name'];
+ $scope.order = function(predicate) {
+ $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false;
+ $scope.predicate[1] = predicate;
+ };
- $scope.query = '';
- $scope.temp = new Item();
- $scope.policyNavigator = new PolicyNavigator();
+ $scope.query = '';
+ $scope.temp = new Item();
+ $scope.policyNavigator = new PolicyNavigator();
- $scope.setTemplate = function(name) {
- $scope.viewTemplate = $cookies.viewTemplate = name;
- };
+ $scope.setTemplate = function(name) {
+ $scope.viewTemplate = $cookies.viewTemplate = name;
+ };
- $scope.touch = function(item) {
- item = item instanceof Item ? item : new Item();
- item.revert();
- $scope.temp = item;
- };
+ $scope.touch = function(item) {
+ item = item instanceof Item ? item : new Item();
+ item.revert();
+ $scope.temp = item;
+ };
- $scope.smartClick = function(item) {
- if (item.isFolder()) {
- return $scope.policyNavigator.folderClick(item);
- }
- if (item.isEditable()) {
- return $scope.openEditItem(item);
- }
- };
+ $scope.smartClick = function(item) {
+ if (item.isFolder()) {
+ return $scope.policyNavigator.folderClick(item);
+ }
+ if (item.isEditable()) {
+ return $scope.openEditItem(item);
+ }
+ };
- $scope.openEditItem = function(item) {
- item.getContent();
- $scope.modal('createNewPolicy');
- return $scope.touch(item);
- };
+ $scope.openEditItem = function(item) {
+ item.getContent();
+ $scope.modal('createNewPolicy');
+ return $scope.touch(item);
+ };
- $scope.modal = function(id, hide) {
- return $('#' + id).modal(hide ? 'hide' : 'show');
- };
+ $scope.modal = function(id, hide) {
+ return $('#' + id).modal(hide ? 'hide' : 'show');
+ };
- $scope.isInThisPath = function(path) {
- var currentPath = $scope.policyNavigator.currentPath.join('/');
- return currentPath.indexOf(path) !== -1;
- };
+ $scope.isInThisPath = function(path) {
+ var currentPath = $scope.policyNavigator.currentPath.join('/');
+ return currentPath.indexOf(path) !== -1;
+ };
- $scope.searchPolicy = function(searchContent){
- if(searchContent != undefined){
- var uuu = "searchPolicy";
- var postData = {searchdata : searchContent};
- $.ajax({
- type : 'POST',
- url : uuu,
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(postData),
- success : function(data){
- $scope.$apply(function(){
- var searchdata = data.result;
- if(searchdata.length > 0){
- if(searchdata[0] == "Exception"){
- Notification.error(searchdata[1]);
- }else{
- $scope.policyNavigator.searchrefresh(searchdata);
- }
- }else{
- Notification.info("No Matches Found with your Search");
- }
- });
- },
- error : function(data){
- Notification.error("Error while Searching.");
- }
- });
- }else{
- Notification.error("No data has been entered or selected to search");
- }
- };
+ $scope.searchPolicy = function(searchContent){
+ if(searchContent != undefined){
+ var uuu = "searchPolicy";
+ var postData = {searchdata : searchContent};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ var searchdata = data.result;
+ if(searchdata.length > 0){
+ if(searchdata[0] == "Exception"){
+ Notification.error(searchdata[1]);
+ }else{
+ $scope.policyNavigator.searchrefresh(searchdata);
+ }
+ }else{
+ Notification.info("No Matches Found with your Search");
+ }
+ });
+ },
+ error : function(data){
+ Notification.error("Error while Searching.");
+ }
+ });
+ }else{
+ Notification.error("No data has been entered or selected to search");
+ }
+ };
$scope.refresh = function(searchData){
- $scope.policyNavigator.searchrefresh(null);
+ $scope.policyNavigator.searchrefresh(null);
};
-
- $scope.getQueryParam = function(param) {
- var found;
- window.location.search.substr(1).split('&').forEach(function(item) {
- if (param === item.split('=')[0]) {
- found = item.split('=')[1];
- return false;
- }
- });
- return found;
- };
+
+ $scope.getQueryParam = function(param) {
+ var found;
+ window.location.search.substr(1).split('&').forEach(function(item) {
+ if (param === item.split('=')[0]) {
+ found = item.split('=')[1];
+ return false;
+ }
+ });
+ return found;
+ };
- $scope.isWindows = $scope.getQueryParam('server') === 'Windows';
- $scope.policyNavigator.searchrefresh(null);
- $scope.policyNavigator.setSearchModalActiveStatus();
+ $scope.isWindows = $scope.getQueryParam('server') === 'Windows';
+ $scope.policyNavigator.searchrefresh(null);
+ $scope.policyNavigator.setSearchModalActiveStatus();
}]);