From 4ca818fdfb9b807562166800a086b413593d6894 Mon Sep 17 00:00:00 2001 From: rb7147 Date: Thu, 27 Jul 2017 14:50:16 -0400 Subject: [PATCH] [POLICY-122] Policy GUI Fixes Added few Policy GUI fixes for Export dictionary feature Added fix for Dashboard policy activitiy table. Change-Id: Ic4e3ef75f9cd26ab53d095c1dff8e29132304ed5 Signed-off-by: rb7147 --- .../policy/controller/DashboardController.java | 53 ++++++++++------------ .../BRMSControllerDictGridController.js | 8 ++++ .../BRMSDependencyDictGridController.js | 8 ++++ .../BRMSParamDictGridController.js | 8 ++++ .../CLPepOptionsDictGridController.js | 8 ++++ .../CLVarbindDictGridController.js | 8 ++++ .../CLVnfTypeDictGridController.js | 8 ++++ .../CLVsclActionDictGridController.js | 8 ++++ .../DecisionSettingsDictGridController.js | 8 ++++ .../DescriptiveScopeDictGridController.js | 8 ++++ .../FWTermListDictGridController.js | 8 ++++ .../RiskTypeDictGridController.js | 8 ++++ .../actionPolicyDictGridController.js | 8 ++++ .../attributeDictGridController.js | 8 ++++ .../ecompNameDictGridController.js | 8 ++++ 15 files changed, 136 insertions(+), 29 deletions(-) diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java index 089470671..230bbe611 100644 --- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java +++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java @@ -226,7 +226,7 @@ public class DashboardController extends RestrictedBaseController{ for (PDPGroup group : this.pdpConatiner.getGroups()){ for (PDP pdp : group.getPdps()){ naCount = -1; - if (pdp.getStatus().getStatus().toString() == "UP_TO_DATE" && ((EcompPDP) pdp).getJmxPort() != 0){ + if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((EcompPDP) pdp).getJmxPort() != 0){ String pdpIpAddress = parseIPSystem(pdp.getId()); int port = ((EcompPDP) pdp).getJmxPort(); if (port != 0){ @@ -321,7 +321,6 @@ public class DashboardController extends RestrictedBaseController{ */ private void addPolicyToTable() { policyActivityData = new ArrayList<>(); - int i = 1; String policyID = null; int policyFireCount = 0; Map policyMap = new HashMap<>(); @@ -338,46 +337,42 @@ public class DashboardController extends RestrictedBaseController{ } for (PDP pdp : group.getPdps()){ - // Add rows to the Policy Table + // Add rows to the Policy Table policyList = null; - if (pdp.getStatus().getStatus().toString() == "UP_TO_DATE" && ((EcompPDP) pdp).getJmxPort() != 0){ + if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((EcompPDP) pdp).getJmxPort() != 0){ String pdpIpAddress = parseIPSystem(pdp.getId()); policyList = getPolicy(pdpIpAddress, ((EcompPDP) pdp).getJmxPort(), "policyCount"); } if (policyList != null && policyList.toString().length() > 3){ - String[] splitPolicy = policyList.toString().split(","); - for (String policyKeyValue : splitPolicy){ - policyID = urnPolicyID(policyKeyValue); - policyFireCount = countPolicyID(policyKeyValue); - if (policyID != null ){ - if (policyMap.containsKey(policyID)){ - JSONObject object = new JSONObject(); - object.put("policyId", policyMap.get(policyID)); - object.put("fireCount", policyFireCount); - object.put("system", pdp.getId()); - policyActivityData.add(i, object); - i++; - } + String[] splitPolicy = policyList.toString().split(","); + for (String policyKeyValue : splitPolicy){ + policyID = urnPolicyID(policyKeyValue); + policyFireCount = countPolicyID(policyKeyValue); + if (policyID != null ){ + if (policyMap.containsKey(policyID)){ + JSONObject object = new JSONObject(); + object.put("policyId", policyMap.get(policyID)); + object.put("fireCount", policyFireCount); + object.put("system", pdp.getId()); + policyActivityData.add(object); } } + } }else { if (policyList != null){ JSONObject object = new JSONObject(); object.put("policyId", "Unable to retrieve policy information"); object.put("fireCount", "NA"); object.put("system", pdp.getId()); - policyActivityData.add(i, object); - i++; + policyActivityData.add(object); }else{ JSONObject object = new JSONObject(); object.put("policyId", "Unable to access PDP JMX Server"); object.put("fireCount", "NA"); object.put("system", pdp.getId()); - policyActivityData.add(i, object); - i++; + policyActivityData.add(object); } } - } } } @@ -399,20 +394,20 @@ public class DashboardController extends RestrictedBaseController{ policyLogger.debug("policyMap value retreived: " + o); return o; } catch (MalformedURLException e) { - policyLogger.error("MalformedURLException for JMX connection"); + policyLogger.error("MalformedURLException for JMX connection" , e); } catch (IOException e) { - policyLogger.error("AttributeNotFoundException for policyMap" ); + policyLogger.error("AttributeNotFoundException for policyMap" , e); } catch (AttributeNotFoundException e) { - policyLogger.error("AttributeNotFoundException for JMX connection"); + policyLogger.error("AttributeNotFoundException for JMX connection", e); } catch (InstanceNotFoundException e) { - policyLogger.error("InstanceNotFoundException " + host + " for JMX connection"); + policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e); } catch (MalformedObjectNameException e) { - policyLogger.error("MalformedObjectNameException for JMX connection"); + policyLogger.error("MalformedObjectNameException for JMX connection", e); } catch (MBeanException e) { - policyLogger.error("MBeanException for JMX connection"); + policyLogger.error("MBeanException for JMX connection", e); policyLogger.error("Exception Occured"+e); } catch (ReflectionException e) { - policyLogger.error("ReflectionException for JMX connection"); + policyLogger.error("ReflectionException for JMX connection", e); } return null; diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js index c8eca84bb..98ae6e71e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js @@ -81,6 +81,14 @@ appDS2.controller('brmsControllerDictGridController', function ($scope, PolicyAp docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js index 596f1bbcd..e3e7dcfa2 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js @@ -80,6 +80,14 @@ app.controller('brmsDependencyDictGridController', function ($scope, PolicyAppSe docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js index fc0cbc1a6..af195738c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js @@ -75,6 +75,14 @@ app.controller('brmsParamDictGridController', function ($scope, PolicyAppService docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js index db6d2a7b1..076704b08 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js @@ -80,6 +80,14 @@ app.controller('pepOptionsDictGridController', function ($scope, PolicyAppServic docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js index b2bb51b64..02fdcd94a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js @@ -79,6 +79,14 @@ app.controller('varbindDictGridController', function ($scope, PolicyAppService, docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js index bea675588..7dc4472c8 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js @@ -78,6 +78,14 @@ app.controller('vnfTypeDictGridController', function ($scope, PolicyAppService, docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js index 512e11464..7898bd9e7 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js @@ -78,6 +78,14 @@ app.controller('vsclActionDictGridController', function ($scope, PolicyAppServic docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js index 01b55d08a..57f64b890 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js @@ -78,6 +78,14 @@ app.controller('decisionSettingsDictGridController', function ($scope, PolicyApp docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js index 8c3493907..8a086e34e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js @@ -78,6 +78,14 @@ app.controller('descriptiveDictGridController', function ($scope, PolicyAppServi docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js index fa54db6d9..2a351059b 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js @@ -94,6 +94,14 @@ app.controller('termListDictGridController', function ($scope, PolicyAppService, docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js index 0e119ba2d..9213f9c39 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js @@ -78,6 +78,14 @@ app.controller('riskTypeDictGridController', function ($scope, PolicyAppService, docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js index e828bd963..17ba68a43 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js @@ -87,6 +87,14 @@ app.controller('actionPolicyDictGridController', function ($scope,modalService, docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js index 554f6d08f..c7b317460 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js @@ -88,6 +88,14 @@ app.controller('attributeDictGridController', function ($scope, PolicyAppService docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js index a7964158c..d010e41b6 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js @@ -79,6 +79,14 @@ app.controller('ecompNameDictGridController', function ($scope, PolicyAppService docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; return docDefinition; }, + exporterFieldCallback: function(grid, row, col, input) { + if( col.name == 'createdDate' || col.name == 'modifiedDate') { + var date = new Date(input); + return date.toString("yyyy-MM-dd HH:MM:ss a"); + } else { + return input; + } + }, exporterPdfOrientation: 'portrait', exporterPdfPageSize: 'LETTER', exporterPdfMaxGridWidth: 500, -- 2.16.6