Added Policy GUI Cosmetic Fixes
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / DCAEMicroServicePolicyController.js
index 94c1bc9..663d884 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * ECOMP Policy Engine
+ * ONAP Policy Engine
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -25,6 +25,13 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
     $scope.savebutton = true;
     $scope.refreshCheck = false;
     
+    if(!$scope.temp.policy.editPolicy  && !$scope.temp.policy.readOnly){
+       $scope.temp.policy = {
+                       policyType : "Config",
+                       configPolicyType : "Micro Service"
+       }
+    };
+    
     $scope.refresh = function(){
        if($scope.refreshCheck){
                $scope.policyNavigator.refresh();
@@ -37,6 +44,15 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
         return $('#' + id).modal(hide ? 'hide' : 'show');
     };
     
+    $('#ttlDate').datepicker({
+       dateFormat: 'dd/mm/yy',
+       changeMonth: true,
+       changeYear: true,
+       onSelect: function(date) {
+               angular.element($('#ttlDate')).triggerHandler('input');
+       }
+    });
+    
        if ($scope.temp.policy.editPolicy != undefined|| $scope.temp.policy.readOnly  != undefined){
                if ($scope.temp.policy.configName == undefined){
                        $scope.isCheck = false;
@@ -47,12 +63,12 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
                $scope.isCheck = false;
        }
                
-       PolicyAppService.getData('getDictionary/get_EcompNameDataByName').then(function (data) {
+       PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
                var j = data;
                $scope.data = JSON.parse(j.data);
                console.log($scope.data);
-               $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas);
-               console.log($scope.ecompNameDictionaryDatas);
+               $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+               console.log($scope.onapNameDictionaryDatas);
        }, function (error) {
                console.log("failed");
        });
@@ -323,25 +339,23 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
 
                                }
 
-                               if (dictionary!= null || dictionary>1){
-                               if (dictionary!= null || dictionary.length>1){
-                                       for (m=0; m < dictionary.length; m += 1){
-                                               var keyCompare = dictionary[m].name;
-                                               var valueCompare = dictionary[m].value;
-                                               var valueModel = dictionary[m].modelName;
-                                               var conpairService = serviceName;
-                                               if (valueModel.includes('-v')){
-                                                       conpairService = service;
-                                               }
-                                               if(valueModel.localeCompare(conpairService) == 0){
-                                                       console.log(valueCompare);      
-                                                       dictionaryList.push(dictionary[m]);
-                                                       if (!dictionaryNameList.includes(dictionary[m].name)){
-                                                               dictionaryNameList.push(dictionary[m].name)
-                                                       }
-                                               }
-                                       }
-                               }
+                               if (dictionary!= null && dictionary.length>1){
+                                       for (m=0; m < dictionary.length; m += 1){
+                                               var keyCompare = dictionary[m].name;
+                                               var valueCompare = dictionary[m].value;
+                                               var valueModel = dictionary[m].modelName;
+                                               var conpairService = serviceName;
+                                               if (valueModel.includes('-v')){
+                                                       conpairService = service;
+                                               }
+                                               if(valueModel.localeCompare(conpairService) == 0){
+                                                       console.log(valueCompare);      
+                                                       dictionaryList.push(dictionary[m]);
+                                                       if (!dictionaryNameList.includes(dictionary[m].name)){
+                                                               dictionaryNameList.push(dictionary[m].name)
+                                                       }
+                                               }
+                                       }
                                }
 
                                $scope.temp.policy.ruleGridData = [];