From: rb7147 Date: Tue, 29 Aug 2017 18:38:54 +0000 (-0400) Subject: Sonar Issue fixes for js X-Git-Tag: v1.1.0~95^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=commitdiff_plain;h=7de5161cb47abb01256272addeda32ad1c1cfaf5 Sonar Issue fixes for js Resolved POLICY-SDK-APP js blockers and critical issues Issue-Id: POLICY-184 Change-Id: I2ec99b4d48fcc2f833c6fd6140fed6d926c3fd9e Signed-off-by: rb7147 --- diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js index 7d352115e..8771ee918 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardController.js @@ -74,17 +74,17 @@ app.controller('policyDashboardHealthController', function ($scope, PolicyAppSer console.log("failed"); }); - $scope.availableGridHealthDatas = { - data : 'systemAlertsTableDatas', - enableFiltering: true, - columnDefs: [{ field: 'id'}, - { field: 'type'}, - { field: 'system'}, - {field: 'logtype'}, - {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, - {field : 'description'} - ], - }; + $scope.availableGridHealthDatas = { + data : 'systemAlertsTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id'}, + { field: 'type'}, + { field: 'system'}, + {field: 'logtype'}, + {field : 'date' ,type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }, + {field : 'description'} + ] + }; $scope.papStatusDatas = { data : 'papTableDatas', @@ -93,7 +93,7 @@ app.controller('policyDashboardHealthController', function ($scope, PolicyAppSer { field: 'status'}, { field: 'noOfPolicy'}, {field: 'noOfConnectedTrap'} - ], + ] }; $scope.pdpStatusDatas = { @@ -107,7 +107,7 @@ app.controller('policyDashboardHealthController', function ($scope, PolicyAppSer {field : 'permitCount'}, {field : 'denyCount'}, {field : 'naCount'} - ], + ] }; $scope.policyActivityDatas = { @@ -116,6 +116,6 @@ app.controller('policyDashboardHealthController', function ($scope, PolicyAppSer columnDefs: [{ field: 'policyId'}, { field: 'fireCount'}, { field: 'system'} - ], + ] }; }); \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js index d880ac6b4..1925e5f48 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/FWPrefixListDictController.js @@ -17,7 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -app.controller('editFWPrefixListController' , function ($scope, $modalInstance, message, Notification, UserInfoServiceDS2, Notification){ +app.controller('editFWPrefixListController' , function ($scope, $modalInstance, message, Notification, UserInfoServiceDS2){ $scope.validate = 'false'; if(message.prefixListDictionaryData==null) $scope.label='Add PrefixList' diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js index a6fa7b291..b93fc8a72 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js @@ -234,7 +234,7 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol } if($scope.jsonData.verificationSignaturesUsedForUI != null){ if($scope.jsonData.verificationSignaturesUsedForUI.signatures != null){ - $scope.temp.policy.triggerfaultSignatures = {Fault1 : [], Fault2 : [], Fault3 : [], Fault4 : [], Fault5 : [], Fault6 : [],}; + $scope.temp.policy.triggerfaultSignatures = {Fault1 : [], Fault2 : [], Fault3 : [], Fault4 : [], Fault5 : [], Fault6 : []}; var splitTraps = $scope.jsonData.verificationSignaturesUsedForUI.signatures.split("#!?!"); if(splitTraps.length > 1){ $scope.verificationdisabled = false; @@ -530,7 +530,7 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol } if($scope.temp.policy.triggerTrapSignatures.length == 3 || $scope.temp.policy.triggerTrapSignatures["Trap3"] != null){ var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, - trap2 : $scope.temp.policy.triggerTrapSignatures.Trap3} + trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerTrapSignatures["Trap4"] != null){ var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, @@ -555,7 +555,7 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol } if($scope.temp.policy.triggerfaultSignatures.length == 3 || $scope.temp.policy.triggerfaultSignatures["Fault3"] != null){ var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, - trap2 : $scope.temp.policy.triggerfaultSignatures.Fault3} + trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerfaultSignatures["Fault4"] != null){ var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js index 5d81bc10d..8dd559c3e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js @@ -323,25 +323,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 = []; diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/service/userInfoServiceDS2.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/service/userInfoServiceDS2.js index 90d7cd1d3..c73fa60a5 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/service/userInfoServiceDS2.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/service/userInfoServiceDS2.js @@ -23,7 +23,7 @@ appDS2.factory('UserInfoServiceDS2', function ($http, $q,$log) { var deferred = $q.defer(); $http({ method: "GET", - url: "get_PolicyUserInfo", + url: "get_PolicyUserInfo" }).success(function(res) { if(res==null || res==''){ $log.error('userInfoServiceDs2: failed to get top menu info');