[POLICY-122] Policy GUI Fixes 05/6305/4
authorrb7147 <rb7147@att.com>
Thu, 27 Jul 2017 18:50:16 +0000 (14:50 -0400)
committerrb7147 <rb7147@att.com>
Thu, 27 Jul 2017 19:29:03 +0000 (15:29 -0400)
Added few Policy GUI fixes for Export dictionary feature
Added fix for Dashboard policy activitiy table.

Change-Id: Ic4e3ef75f9cd26ab53d095c1dff8e29132304ed5
Signed-off-by: rb7147 <rb7147@att.com>
15 files changed:
POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTermListDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/attributeDictGridController.js
POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/ecompNameDictGridController.js

index 0894706..230bbe6 100644 (file)
@@ -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<String, String> 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;
index c8eca84..98ae6e7 100644 (file)
@@ -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,
index 596f1bb..e3e7dcf 100644 (file)
@@ -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,
index fc0cbc1..af19573 100644 (file)
@@ -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,
index db6d2a7..076704b 100644 (file)
@@ -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,
index b2bb51b..02fdcd9 100644 (file)
@@ -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,
index bea6755..7dc4472 100644 (file)
@@ -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,
index 512e114..7898bd9 100644 (file)
@@ -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,
index 01b55d0..57f64b8 100644 (file)
@@ -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,
index 8c34939..8a086e3 100644 (file)
@@ -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,
index fa54db6..2a35105 100644 (file)
@@ -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,
index 0e119ba..9213f9c 100644 (file)
@@ -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,
index e828bd9..17ba68a 100644 (file)
@@ -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,
index 554f6d0..c7b3174 100644 (file)
@@ -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,
index a796415..d010e41 100644 (file)
@@ -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,