Policy 1707 Second commit
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / ClosedLoopPMController.js
index 2f709a7..3937807 100644 (file)
  * 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