Resolved Policy GUI Issues
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / BRMSRawPolicyController.js
index 5b78193..8f27f2a 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============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('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.temp.policy = "";
+    };
+    
+    $scope.modal = function(id, hide) {
+        return $('#' + id).modal(hide ? 'hide' : 'show');
+    };
+    
+    $('#ttlDate').datepicker({
+       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;
@@ -54,7 +76,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 +175,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