diff options
author | ITSERVICES\rb7147 <rb7147@att.com> | 2017-05-08 22:20:44 -0400 |
---|---|---|
committer | ITSERVICES\rb7147 <rb7147@att.com> | 2017-05-09 13:58:03 -0400 |
commit | dda032f8bb161d54eb1f59de2b4a3efb774fc4d1 (patch) | |
tree | 9a11825d59434d97bb0c7dcbf00a0b84e7e5f526 /POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models | |
parent | a330af579866dacbe595e2e4ad1dd29cd3c96945 (diff) |
Policy 1707 Second commit
Change-Id: I18f5b142238733d17280cf17c3d1dd28204d34e9
Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models')
27 files changed, 606 insertions, 218 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js index fde8d4e9e..6ca9dfd93 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js @@ -17,12 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('actionPolicyController', function ($scope, PolicyAppService, modalService, $modal, Notification) { +app.controller('actionPolicyController', ['$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) { $("#dialog").hide(); + $scope.policyNavigator; $scope.savebutton = true; - $scope.finalPath = null; - + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; + PolicyAppService.getData('getDictionary/get_ActionPolicyDictDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); @@ -61,7 +73,11 @@ angular.module('abs').controller('actionPolicyController', function ($scope, Pol } $scope.saveActionPolicy = function(policy){ - 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}; @@ -82,7 +98,6 @@ angular.module('abs').controller('actionPolicyController', function ($scope, Pol Notification.error("Policy Already Exists with Same Name in Scope."); } }); - console.log($scope.data); }, error : function(data){ Notification.error("Error Occured while saving Policy."); @@ -92,9 +107,8 @@ angular.module('abs').controller('actionPolicyController', function ($scope, Pol }; $scope.validatePolicy = function(policy){ - console.log(policy); document.getElementById("validate").innerHTML = ""; - var uuu = "policyController/validate_policy.htm"; + var uuu = "policyController/validate_policy.htm"; var postData={policyData: policy}; $.ajax({ type : 'POST', @@ -118,7 +132,6 @@ angular.module('abs').controller('actionPolicyController', function ($scope, Pol } }); - console.log($scope.data); }, error : function(data){ Notification.error("Validation Failed."); @@ -170,4 +183,4 @@ angular.module('abs').controller('actionPolicyController', function ($scope, Pol $scope.temp.policy.ruleAlgorithmschoices.splice(lastItem); }; -});
\ No newline at end of file +}]);
\ No newline at end of file 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 c5160e741..ebec3a526 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 @@ -17,11 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('brmsParamPolicyController', function ($scope, $window, PolicyAppService, modalService, $modal, Notification) { +angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) { $("#dialog").hide(); + $scope.policyNavigator; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; $scope.validateSuccess = true; var readValue = $scope.temp.policy.readOnly; @@ -129,7 +141,11 @@ angular.module('abs').controller('brmsParamPolicyController', function ($scope, }; $scope.saveBrmsParamPolicy = function(policy){ - 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}; @@ -231,7 +247,7 @@ angular.module('abs').controller('brmsParamPolicyController', function ($scope, var lastItem = $scope.temp.policy.attributes.length-1; $scope.temp.policy.attributes.splice(lastItem); }; -}); +}]); app.controller('showrulecontroller' , function ($scope, $modalInstance, message){ if(message.datas!=null){ 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 5b78193ee..97f6d2997 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,11 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('brmsRawPolicyController', function ($scope, $window, PolicyAppService, 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; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; PolicyAppService.getData('getDictionary/get_BRMSControllerDataByName').then(function (data) { var j = data; @@ -54,7 +66,11 @@ angular.module('abs').controller('brmsRawPolicyController', function ($scope, $w }); $scope.saveBrmsRawPolicy = function(policy){ - 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}; @@ -149,4 +165,4 @@ angular.module('abs').controller('brmsRawPolicyController', function ($scope, $w var lastItem = $scope.temp.policy.attributes.length-1; $scope.temp.policy.attributes.splice(lastItem); }; -});
\ No newline at end of file +}]);
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js index 9f2863579..20287baf1 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js @@ -17,11 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -app.controller('baseConfigController', function ($scope, PolicyAppService, modalService, $modal, Notification) { +app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) { $("#dialog").hide(); + + $scope.policyNavigator; $scope.savebutton = true; - + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; + PolicyAppService.getData('getDictionary/get_EcompNameDataByName').then(function (data) { var j = data; $scope.data = JSON.parse(j.data); @@ -61,8 +75,12 @@ app.controller('baseConfigController', function ($scope, PolicyAppService, modal } $scope.savePolicy = 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({ @@ -92,7 +110,7 @@ app.controller('baseConfigController', function ($scope, PolicyAppService, modal $scope.validatePolicy = function(policy){ - console.log(policy); + $scope.scope = policy.domain; document.getElementById("validate").innerHTML = ""; var uuu = "policyController/validate_policy.htm"; var postData={policyData: policy}; @@ -150,5 +168,4 @@ app.controller('baseConfigController', function ($scope, PolicyAppService, modal var lastItem = $scope.temp.policy.attributes.length-1; $scope.temp.policy.attributes.splice(lastItem); }; - -});
\ No newline at end of file +}]);
\ No newline at end of file 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 a8dcd7b0a..11254742a 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,11 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module("abs").controller('clFaultController', function($scope, $window, PolicyAppService, modalService, $modal, Notification){ +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.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; if($scope.temp.policy.triggerTrapSignatures == undefined){ $scope.temp.policy.triggerTrapSignatures = []; @@ -501,7 +513,11 @@ angular.module("abs").controller('clFaultController', function($scope, $window, }; $scope.saveFaultPolicy = function(policy){ - console.log(policy); + if(policy.itemContent != undefined){ + $scope.refreshCheck = true; + $scope.policyNavigator = policy.itemContent; + policy.itemContent = ""; + } $scope.savebutton = false; var data = {}; var faultData = {}; @@ -780,4 +796,4 @@ angular.module("abs").controller('clFaultController', function($scope, $window, }; -});
\ No newline at end of file +}]);
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js index 2f709a716..393780705 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js @@ -17,11 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module("abs").controller('clPMController', function($scope, $window, $timeout, PolicyAppService, modalService, $modal, Notification){ +angular.module("abs").controller('clPMController', ['$scope', '$window', '$timeout', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function($scope, $window, $timeout, PolicyAppService, PolicyNavigator, modalService, $modal, Notification){ $("#dialog").hide(); + $scope.policyNavigator; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; PolicyAppService.getData('getDictionary/get_EcompNameDataByName').then(function (data) { var j = data; @@ -88,7 +100,11 @@ angular.module("abs").controller('clPMController', function($scope, $window, $ti }; $scope.saveCLPMPolicy = function(policy){ - 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}; @@ -160,4 +176,4 @@ angular.module("abs").controller('clPMController', function($scope, $window, $ti }); }; -})
\ No newline at end of file +}]);
\ No newline at end of file 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 d0f44d46e..b87299cbd 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 @@ -17,13 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('dcaeMicroServiceController', function ($scope, $window, $compile, PolicyAppService, modalService, $modal, Notification) { +angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$window', '$compile', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, $window, $compile, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) { $("#dialog").hide(); + + $scope.policyNavigator; $scope.isCheck = false; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; -// $scope.temp.policy.ttlDate = "2016-12-31"; if ($scope.temp.policy.editPolicy != undefined|| $scope.temp.policy.readOnly != undefined){ if ($scope.temp.policy.configName == undefined){ $scope.isCheck = false; @@ -384,11 +396,17 @@ angular.module('abs').controller('dcaeMicroServiceController', function ($scope, } function getList(attribute) { - + var enumName = attribute; + console.log("In getList: attribute => " + attribute); + if(attribute){ + if(attribute.includes(":")){ + enumName = attribute.split(":")[0]; + } + } var baseEnum = $scope.dcaeModelData.enumValues; var enumList = baseEnum.split(splitEnum); var enumAttributes; - var patternTest = new RegExp(attribute); + var patternTest = new RegExp(enumName); for (k=0; k < enumList.length; k += 1){ if(patternTest.test(enumList[k]) == true){ enumAttributes = enumList[k].trim(); @@ -399,12 +417,9 @@ angular.module('abs').controller('dcaeMicroServiceController', function ($scope, enumAttributes = enumAttributes.replace("[", ""); enumAttributes = enumAttributes.replace("]", ""); enumAttributes = enumAttributes.replace(/ /g, ''); - var dropListAfterCommaSplit = enumAttributes.split(splitEqual); listemunerateValues = dropListAfterCommaSplit[1].split(splitComma); - - enumKeyList.push(attribute); - + //enumKeyList.push(attribute); return listemunerateValues; } @@ -704,7 +719,10 @@ angular.module('abs').controller('dcaeMicroServiceController', function ($scope, option.appendChild(document.createTextNode(listemunerateValues[i])); listField.appendChild(option); } - listField.setAttribute("id" , ''+ labelLevel + attributeName + '');; + listField.setAttribute("id" , ''+ labelLevel + attributeName + ''); + + enumKeyList.push(attributeName); + document.getElementById(divID).appendChild(label); document.getElementById(divID).appendChild(br); @@ -750,6 +768,11 @@ angular.module('abs').controller('dcaeMicroServiceController', function ($scope, } $scope.savePolicy = function(policy){ + if(policy.itemContent != undefined){ + $scope.refreshCheck = true; + $scope.policyNavigator = policy.itemContent; + policy.itemContent = ""; + } $scope.savebutton = false; var splitAt = '*'; var dot ='.'; @@ -926,4 +949,4 @@ angular.module('abs').controller('dcaeMicroServiceController', function ($scope, } return obj; } -});
\ No newline at end of file +}]);
\ No newline at end of file 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 f5932e2f4..d0c72682b 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,10 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('decisionPolicyController', function ($scope, PolicyAppService, modalService, $modal, Notification) { +angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) { $("#dialog").hide(); + + $scope.policyNavigator; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; if($scope.temp.policy.ruleProvider==undefined){ $scope.temp.policy.ruleProvider="Custom"; @@ -76,6 +89,11 @@ angular.module('abs').controller('decisionPolicyController', function ($scope, P } $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"; @@ -146,7 +164,7 @@ angular.module('abs').controller('decisionPolicyController', function ($scope, P $scope.temp.policy.attributes = []; $scope.temp.policy.settings = []; $scope.temp.policy.ruleAlgorithmschoices = []; - }else{ + }else if($scope.temp.policy.ruleProvider=="Custom"){ if($scope.temp.policy.attributes.length == 0){ $scope.temp.policy.attributes = []; } @@ -206,4 +224,4 @@ angular.module('abs').controller('decisionPolicyController', function ($scope, P $scope.temp.policy.attributes = []; } }; -});
\ No newline at end of file +}]);
\ No newline at end of file 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 cc051769c..46b6711cd 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,11 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -angular.module('abs').controller('fwPolicyController', function ($scope, $window, PolicyAppService, 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; $scope.savebutton = true; - $scope.finalPath = null; + $scope.refreshCheck = false; + + $scope.refresh = function(){ + if($scope.refreshCheck){ + $scope.policyNavigator.refresh(); + } + $scope.modal('createNewPolicy', true); + }; + + $scope.modal = function(id, hide) { + return $('#' + id).modal(hide ? 'hide' : 'show'); + }; PolicyAppService.getData('getDictionary/get_SecurityZoneDataByName').then(function (data) { var j = data; @@ -113,6 +125,11 @@ angular.module('abs').controller('fwPolicyController', function ($scope, $window $scope.saveFWPolicy = 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"; @@ -224,4 +241,4 @@ angular.module('abs').controller('fwPolicyController', function ($scope, $window $scope.temp.policy.fwattributes.splice(lastItem); }; -});
\ No newline at end of file +}]);
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html index 3b60c9b19..ffb0e972f 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html @@ -133,10 +133,7 @@ <button class="btn btn-success" ng-disabled="savebutton" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" ng-click="saveActionPolicy(temp);">Save</button> - <button class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" - ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </form> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html index 6989a8509..2aa3b23d9 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html @@ -47,7 +47,7 @@ <div class="form-group row"> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" ng-model="temp.policy.ttlDate" /> </div> <div class="form-group col-sm-3"> @@ -136,10 +136,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="saveBrmsParamPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-model="finalPath" - ng-controller="FileManagerCtrl" - ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html index 75b8c3ba2..a778b13fe 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html @@ -46,7 +46,7 @@ <div class="form-group row"> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" ng-model="temp.policy.ttlDate" /> </div> <div class="form-group col-sm-3"> @@ -116,10 +116,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="saveBrmsRawPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" - ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html index 16b8cad9a..1ecfd2fbd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html @@ -31,7 +31,7 @@ </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" ng-disabled="temp.policy.readOnly" name="ttlDate" class="date" ng-model="temp.policy.ttlDate" /> </div> </div> @@ -132,7 +132,7 @@ herf="javascript:void(0)" ng-click="validatePolicy(temp.policy);">Validate</button> <button class="btn btn-success" ng-disabled="savebutton" herf="javascript:void(0)" ng-click="savePolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html index 6590d2690..e831bb40e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html @@ -68,7 +68,7 @@ <option>InActive</option> </select> </div> - <div class="form-group col-sm-6"> + <div class="form-group col-sm-3"> <label>D2/Virtualized Services(s):<sup><b>*</b></sup></label><br> <input type="checkbox" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.trinity"> Hosted Voice @@ -81,6 +81,11 @@ type="checkbox" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.vDNS"> vDNS</input> </div> + <div class="form-group col-sm-3"> + <label>Time to Live Date:</label> <input type="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" + ng-model="temp.policy.ttlDate" /> + </div> </div> </div> <div class="well"> @@ -492,9 +497,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="saveFaultPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </form> </div>
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html index e22070308..20781a369 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html @@ -25,7 +25,7 @@ </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" ng-model="temp.policy.ttlDate" /> </div> <div class="form-group col-sm-3"> @@ -148,10 +148,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="saveCLPMPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" - ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html index 945e8655a..a12300b97 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html @@ -25,7 +25,7 @@ </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" ng-model="temp.policy.ttlDate" /> </div> <div class="form-group col-sm-3"> @@ -126,9 +126,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="savePolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </form> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html index d386770b9..a98dbff1d 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html @@ -31,10 +31,93 @@ ng-click="providerListener(temp.policy.ruleProvider);"> <option>Custom</option> <option>AAF</option> + <option>GUARD_YAML</option> </select> </div> </div> </div> + + <div ng-if="temp.policy.ruleProvider == 'GUARD_YAML'"> + <div class="well"> + <div class="form-group row"> + <div class="form-group col-sm-1"> + <label>Guard YAML Attributes:</label><br> + </div> + </div> + <div class="form-group row"> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> actor: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor" + placeholder="Actor" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> recipe: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe" + placeholder="Recipe" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> limit: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.limit" + placeholder="Limit" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> timeWindow: </label> + </div> + <div class="form-group col-sm-3"> + <select class="form-control" ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.timeWindow"> + <option>tw5min</option> + <option>tw10min</option> + <option>tw30min</option> + <option>tw1h</option> + <option>tw12h</option> + <option>tw1d</option> + <option>tw5d</option> + <option>tw1w</option> + <option>tw1mon</option> + </select> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> guardActiveStart: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart" + placeholder="00:00:00-05:00" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> guardActiveEnd: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd" + placeholder="00:00:00-05:00" /> + </div> + </div> + </div> + </div> + </div> + <div ng-if="temp.policy.ruleProvider == 'Custom'"> <div class="well"> @@ -179,9 +262,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" ng-click="saveDecisionPolicy(temp);">Save</button> - <button class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </form> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html index 85ffbf7ab..2a4a6534f 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html @@ -51,7 +51,7 @@ </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="date" - class="form-control" name="ttlDate" class="date" + class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" class="date" ng-model="temp.policy.ttlDate" /> </div> <div class="form-group col-sm-3"> @@ -111,9 +111,7 @@ <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" ng-disabled="savebutton" ng-click="saveFWPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" data-dismiss="modal" - ng-disabled="temp.inprocess" ng-model="finalPath" - ng-controller="FileManagerCtrl" ng-click="closefunction(finalPath);">Close</button> + <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> </div> </form> </div>
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html index 568387827..ada2428ed 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html @@ -26,7 +26,7 @@ <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">{{"close" + <span class="sr-only">{{"close" | translate}}</span> </button> <form> 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 869d26ba3..d471f2763 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 @@ -208,55 +208,12 @@ app.controller('PolicyManagerController', [ } }); }; - - $scope.search = function(search){ - var deferred = $q.defer(); - var uuu = "searchPolicy"; - var postData = {searchdata : search}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - $scope.searchdata=data.result;}); - if($scope.searchdata[0].error != undefined){ - Notification.info($scope.searchdata[0].error); - }else{ - var j = data; - $scope.data = JSON.stringify(data.result); - $scope.searchDatas = JSON.parse($scope.data); - var searchString = "Policies List" + "<br>"; - var i; - for(i = 0 ; i < $scope.searchDatas.length; i++){ - searchString += $scope.searchDatas[i].name + ".xml" + "<br>"; - } - var myWindow = window.open("", "MsgWindow", "width=500,height=500"); - myWindow.document.write("<p>Search List</p>"); - myWindow.document.write("<p>"+searchString+"</p>"); - } - }, - error : function(data){ - alert("Error while Searching."); - } - }); - }; - - - /* $scope.describePolicy = function(item){ - item.describePolicy().then(function(){ - $scope.modal('describePolicy', true); - }); - }; - - $scope.exportPolicy = function(item){ - item.exportPolicy().then(function(){ - $scope.modal('exportPolicy', true); - }); - };*/ + + $scope.refresh = function(){ + $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'; @@ -268,13 +225,6 @@ app.controller('PolicyManagerController', [ }); }; - - /* $scope.viewPolicy = function(item){ - item.viewPolicy().then(function(){ - $scope.modal('createNewPolicy', true); - }); - };*/ - $scope.copy = function(item) { var samePath = item.tempModel.path.join() === item.model.path.join(); if (samePath && $scope.policyNavigator.fileNameExists(item.tempModel.name)) { 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 new file mode 100644 index 000000000..83c3820a6 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js @@ -0,0 +1,204 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP Policy Engine + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============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"); + }); + + 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_EcompNameDataByName').then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + 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_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('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; + }; + + $scope.query = ''; + $scope.temp = new Item(); + $scope.policyNavigator = new PolicyNavigator(); + + $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.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.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.searchPolicy = function(searchContent){ + var deferred = $q.defer(); + 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){ + $scope.policyNavigator.searchrefresh(searchdata); + }else{ + Notification.info("No Matches Found with your Search"); + } + }); + }, + error : function(data){ + alert("Error while Searching."); + } + }); + }; + + $scope.refresh = function(searchData){ + $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.isWindows = $scope.getQueryParam('server') === 'Windows'; + $scope.policyNavigator.searchrefresh(null); + $scope.policyNavigator.setSearchModalActiveStatus(); + }]); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js index 2b1fd3469..21762ce77 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js @@ -170,7 +170,7 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun }; - Item.prototype.getContent = function() { + Item.prototype.getContent = function(policyNavigator) { var self = this; var deferred = $q.defer(); var data = {params: { @@ -185,6 +185,7 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun var json = data.result; var policy = JSON.parse(json); self.policy = policy; + self.itemContent = policyNavigator; console.log(policy); self.deferredHandler(data, deferred); }).error(function(data) { @@ -339,9 +340,5 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun return !this.isFolder() && policyManagerConfig.isEditableFilePattern.test(this.model.name); }; - /*Item.prototype.isImage = function() { - return policyManagerConfig.isImageFilePattern.test(this.model.name); - };*/ - return Item; }]); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/providers/config.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/providers/config.js index 72fd84d53..6afabe136 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/providers/config.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/providers/config.js @@ -42,6 +42,7 @@ addSubScopeUrl : 'fm/addSubScopeUrl', switchVersionUrl : 'fm/switchVersionUrl', exportUrl : 'fm/exportUrl', + searchListUrl : 'fm/searchListUrl', sidebar: true, breadcrumb: true, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js index bb76dd9d5..1435afe8a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/services/policynavigator.js @@ -30,8 +30,13 @@ this.currentPath = []; this.history = []; this.error = ''; + this.searchModalActive = false; }; + PolicyNavigator.prototype.setSearchModalActiveStatus = function(){ + this.searchModalActive = true; + }; + PolicyNavigator.prototype.deferredHandler = function(data, deferred, defaultMsg) { if (!data || typeof data !== 'object') { this.error = 'Bridge response error, please check the docs'; @@ -99,29 +104,49 @@ PolicyNavigator.prototype.refresh = function() { var self = this; var path = self.currentPath.join('/'); - return self.list().then(function(data) { - self.fileList = (data.result || []).map(function(file) { - return new Item(file, self.currentPath); - }); - self.buildTree(path); - }); + if(self.searchModalActive){ + return self.searchlist(null).then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); + }else{ + return self.list().then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); + } }; - PolicyNavigator.prototype.policylist = function(finalpath) { + PolicyNavigator.prototype.searchlist = function(policyList) { var self = this; var deferred = $q.defer(); - var path = finalpath; - var data = {params: { - mode: 'LIST', - onlyFolders: false, - path: '/' + path - }}; + var path = self.currentPath.join('/'); + var data; + if(policyList == null){ + data = {params: { + mode: 'SEARCHLIST', + onlyFolders: false, + path: '/' + path + }}; + }else{ + data = {params: { + mode: 'SEARCHLIST', + onlyFolders: false, + path: '/' + path, + policyList : policyList + }}; + } + self.requesting = true; self.fileList = []; self.error = ''; - $http.post(policyManagerConfig.listUrl, data).success(function(data) { + $http.post(policyManagerConfig.searchListUrl, data).success(function(data) { self.deferredHandler(data, deferred); }).error(function(data) { self.deferredHandler(data, deferred, 'Unknown error listing, check the response'); @@ -131,16 +156,15 @@ return deferred.promise; }; - PolicyNavigator.prototype.policyrefresh = function(finalpath) { - var self = this; - var path = finalpath; - self.currentPath = path; - return self.policylist(finalpath).then(function(data) { - self.fileList = (data.result || []).map(function(file) { - return new Item(file, self.currentPath); - }); - self.buildTree(path); - }); + PolicyNavigator.prototype.searchrefresh = function(policyList) { + var self = this; + var path = self.currentPath.join('/'); + return self.searchlist(policyList).then(function(data) { + self.fileList = (data.result || []).map(function(file) { + return new Item(file, self.currentPath); + }); + self.buildTree(path); + }); }; diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html index 5ef11b219..3c41fbc1d 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html @@ -47,7 +47,7 @@ </a> </li> <li ng-show="config.allowedActions.edit && !temp.isFolder()"> - <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="editPolicyId" ng-click="temp.getContent();"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#createNewPolicy" ng-show="editPolicyId" ng-click="temp.getContent(policyNavigator);"> <i class="glyphicon glyphicon-pencil"></i> Edit Policy </a> </li> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html index f2b2b8d9d..6bd9587ef 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html @@ -4,17 +4,16 @@ <form ng-submit="remove(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Confirm</h4> </div> - <div> + <div class="modal-body"> Are you Sure to delete <b>{{temp.model.name}}</b> ? <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button> <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button> </div> </form> @@ -28,12 +27,11 @@ <form ng-submit="removePolicy(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Confirm</h4> </div> - <div>Are you Sure to delete <b>{{temp.model.name}}</b> ? + <div class="modal-body">Are you Sure to delete <b>{{temp.model.name}}</b> ? <div> <p> <input type = "radio" ng-model ="temp.model.versions" name = "radSize" id = "sizeSmall" value = "CURRENT" checked = "checked" /><label for = "sizeSmall">Are you sure you want to delete Current Version of Policy</label> @@ -44,7 +42,7 @@ <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> + <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button> <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button> </div> </form> @@ -58,16 +56,14 @@ <form ng-submit="rename(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Rename</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Enter New Name : <b>{{temp.model.name}}</b></label> <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> - <div ng-include data-src="'path-selector'" class="clearfix"></div> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> @@ -85,7 +81,6 @@ <form> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">List of Policies</h4> @@ -107,12 +102,11 @@ <form ng-submit="move(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Move Policy</h4> </div> - <div> + <div class="modal-body"> <div ng-include data-src="'path-selector'" class="clearfix"></div> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> @@ -131,16 +125,15 @@ <form ng-submit="switchVersion(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Switch Version</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Highest Version <b></b></label> <input class="form-control" ng-disabled="true" ng-model="temp.tempModel.content.highestVersion" autofocus="autofocus"> </div> - <div> + <div class="modal-body"> <label class="radio">Active Version <b></b></label> <select class="form-control" ng-model="temp.tempModel.content.activeVersion" ng-options="option for option in temp.tempModel.content.availableVersions" autofocus="autofocus"></select> <div ng-include data-src="'error-bar'" class="clearfix"></div> @@ -160,12 +153,11 @@ <form ng-submit="copy(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Clone Policy</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Enter new Policy Name to Clone <b>{{temp.model.name}}</b></label> <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> @@ -187,12 +179,11 @@ <form ng-submit="createFolder(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Add Scope</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Scope Name</label> <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> <div ng-include data-src="'error-bar'" class="clearfix"></div> @@ -212,12 +203,11 @@ <form ng-submit="subScopeFolder(temp)"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Add Sub Scope</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Scope Name</label> <input class="form-control" ng-model="temp.tempModel.subScopename" autofocus="autofocus"> <div ng-include data-src="'error-bar'" class="clearfix"></div> @@ -237,12 +227,11 @@ <form ng-submit="uploadFiles()"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Import</h4> </div> - <div> + <div class="modal-body"> <label class="radio">Upload to</label> <input type="file" class="form-control" ng-file="$parent.uploadFileList" autofocus="autofocus" multiple="multiple"/> <div ng-include data-src="'error-bar'" class="clearfix"></div> @@ -266,7 +255,6 @@ <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Select the Destination Scope</h4> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html index 43eb5148b..72985a190 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html @@ -102,7 +102,7 @@ body { </div> </div> <div class="form-group row"> - <div class="form-group col-sm-6"> + <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_PM'"> <label>D2 Service:</label><BR> <select class="form-control" ng-model="search.d2Service"> <option>Hosted Voice(Trinity)</option> @@ -112,18 +112,15 @@ body { <option>vDNS</option> </select> </div> - <div class="form-group col-sm-6"> - <label>Bind Text Search to:</label><BR> <select - class="form-control" ng-model="search.bindTextSearch"> - <option>Email Address</option> - <option>Trigger Signature</option> - <option>Connect All Traps</option> - <option>Verification Signature</option> - <option>Connect All Faults</option> - <option>Onset Message</option> - <option>Policy Name</option> - <option>Abatement Message</option> - <option>Geo Link</option> + <div class="form-group col-sm-6" + ng-if="search.closedLooppolicyType == 'Config_PM'"> + <label>Service Type:</label><BR> <select + class="form-control" ng-model="search.serviceType"> + <option>Registration Failure(Trinity)</option> + <option>International Fraud(Trinity)</option> + <option>No Dial Tone(Trinity)</option> + <option>Call Storm(Trinity)</option> + <option>Registration Storm(Trinity)</option> </select> </div> </div> @@ -150,15 +147,18 @@ body { class="form-control" ng-model="search.vproAction" ng-options="option for option in vsclActionDictionaryDatas track by option"></select> </div> - <div class="form-group col-sm-6" - ng-if="search.closedLooppolicyType == 'Config_PM'"> - <label>Service Type:</label><BR> <select - class="form-control" ng-model="search.serviceType"> - <option>Registration Failure(Trinity)</option> - <option>International Fraud(Trinity)</option> - <option>No Dial Tone(Trinity)</option> - <option>Call Storm(Trinity)</option> - <option>Registration Storm(Trinity)</option> + <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_Fault'"> + <label>Bind Text Search to:</label><BR> <select + class="form-control" ng-model="search.bindTextSearch"> + <option>Email Address</option> + <option>Trigger Signature</option> + <option>Connect All Traps</option> + <option>Verification Signature</option> + <option>Connect All Faults</option> + <option>Onset Message</option> + <option>Policy Name</option> + <option>Abatement Message</option> + <option>Geo Link</option> </select> </div> </div> @@ -166,8 +166,12 @@ body { </form> </div> </div> + <button type="button" class="btn btn-default" + ng-click="refresh(search = null);"> + <span aria-hidden="true">Clear</span> + </button> <button type="button" class="btn btn-primary" - ng-click="search(search);"> + ng-click="searchPolicy(search);"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> </button> </div> |