/*-
* ============LICENSE_START=======================================================
- * ECOMP Policy Engine
+ * ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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;
+
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Action"
+ }
+ };
+
+ $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');
+ };
+
PolicyAppService.getData('getDictionary/get_ActionPolicyDictDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
}
$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};
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 uuu = "policyController/validate_policy.htm";
var postData={policyData: policy};
$.ajax({
type : 'POST',
}
});
- console.log($scope.data);
},
error : function(data){
Notification.error("Validation Failed.");
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
$scope.temp.policy.attributes = [];
+ $scope.temp.policy.attributes.push({'id':'choice'+1});
$scope.temp.policy.ruleAlgorithmschoices = [];
}else{
if($scope.temp.policy.attributes.length == 0){
$scope.temp.policy.ruleAlgorithmschoices.splice(lastItem);
};
-});
\ No newline at end of file
+}]);
\ No newline at end of file