Remove unused vars and methods
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / FirewallPolicyController.js
index cc05176..1d39c4f 100644 (file)
@@ -1,8 +1,8 @@
 /*-
  * ============LICENSE_START=======================================================
- * ECOMP Policy Engine
+ * 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.
  * 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;
+    
+    if(!$scope.temp.policy.editPolicy  && !$scope.temp.policy.readOnly){
+       $scope.temp.policy = {
+                       policyType : "Config",
+                       configPolicyType : "Firewall Config"
+       }
+    };
+    
+    $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_SecurityZoneDataByName').then(function (data) {
        var j = data;
@@ -83,13 +112,6 @@ angular.module('abs').controller('fwPolicyController', function ($scope, $window
        console.log("failed");
     });
 
-    function extend(obj, src) {
-        for (var key in src) {
-            if (src.hasOwnProperty(key)) obj[key] = src[key];
-        }
-        return obj;
-    }
-    
     $scope.viewFWRule = function(policy){
         console.log(policy);
         var uuu = "policyController/ViewFWPolicyRule.htm";
@@ -113,6 +135,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 +251,4 @@ angular.module('abs').controller('fwPolicyController', function ($scope, $window
       $scope.temp.policy.fwattributes.splice(lastItem);
     };
         
-});
\ No newline at end of file
+}]);