From 44bae6729336dfc47f1aaaa2c4e88f4e32e207ce Mon Sep 17 00:00:00 2001 From: "Wang,Frank(gw1218)" Date: Wed, 22 Aug 2018 13:44:09 -0500 Subject: Enhancement on Dashboard Enhancement on dashboard by including more info related to CRUD actions on policies and also providing an advanced search feature. Issue-ID: POLICY-1042 Change-Id: I987e0ca13824413f90299a366fb4464fca7de06a Signed-off-by: Wang,Frank(gw1218) --- .../policy/controller/DashboardController.java | 1011 +++++++++++++------- .../controller/dashboardCRUDController.js | 156 +++ .../app/policyApp/controller/policyController.js | 6 +- .../webapp/app/policyApp/main/policyEditor.html | 1 + .../policyApp/policy-models/Editor/css/main.css | 83 +- .../policy-models/policy_DashboardCRUD.html | 99 ++ .../policy-models/policy_DashboardHealth.html | 6 +- .../policy-models/policy_DashboardLogging.html | 6 +- 8 files changed, 1000 insertions(+), 368 deletions(-) create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js create mode 100644 POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardCRUD.html (limited to 'POLICY-SDK-APP/src') diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java index d1483a223..d3af75dfd 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -20,9 +20,20 @@ package org.onap.policy.controller; - +import com.att.research.xacml.api.pap.PAPException; +import com.att.research.xacml.api.pap.PDP; +import com.att.research.xacml.api.pap.PDPGroup; +import com.att.research.xacml.api.pap.PDPPolicy; +import com.att.research.xacml.util.XACMLProperties; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; +import java.io.PrintWriter; import java.net.MalformedURLException; +import java.sql.Timestamp; +import java.time.LocalDate; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -30,7 +41,6 @@ import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; @@ -43,7 +53,6 @@ import javax.management.remote.JMXServiceURL; import javax.script.SimpleBindings; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import org.json.JSONObject; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; @@ -51,6 +60,8 @@ import org.onap.policy.dao.SystemLogDbDao; import org.onap.policy.model.PDPGroupContainer; import org.onap.policy.rest.XACMLRestProperties; import org.onap.policy.rest.dao.CommonClassDao; +import org.onap.policy.rest.jpa.PolicyEntity; +import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.api.pap.OnapPDP; import org.onap.policy.xacml.api.pap.OnapPDPGroup; @@ -61,365 +72,641 @@ import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import com.att.research.xacml.api.pap.PAPException; -import com.att.research.xacml.api.pap.PDP; -import com.att.research.xacml.api.pap.PDPGroup; -import com.att.research.xacml.api.pap.PDPPolicy; -import com.att.research.xacml.util.XACMLProperties; -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; - @Controller @RequestMapping({"/"}) -public class DashboardController extends RestrictedBaseController{ - private static final Logger policyLogger = FlexLogger.getLogger(DashboardController.class); - @Autowired - CommonClassDao commonClassDao; - - @Autowired - SystemLogDbDao systemDAO; - - public void setCommonClassDao(CommonClassDao commonClassDao) { - this.commonClassDao = commonClassDao; - } - public void setSystemLogDbDao(SystemLogDbDao systemDAO){ - this.systemDAO = systemDAO; - } - - private int pdpCount; - private PDPGroupContainer pdpConatiner; - private ArrayList pdpStatusData; - private ArrayList papStatusData; - private ArrayList policyActivityData; - - private PolicyController policyController; - public PolicyController getPolicyController() { - return policyController; - } - - public void setPolicyController(PolicyController policyController) { - this.policyController = policyController; - } - - private PolicyController getPolicyControllerInstance(){ - return policyController != null ? getPolicyController() : new PolicyController(); - } - - @RequestMapping(value={"/get_DashboardLoggingData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) - public void getData(HttpServletRequest request, HttpServletResponse response){ - try{ - Map model = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); - model.put("availableLoggingDatas", mapper.writeValueAsString(systemDAO.getLoggingData())); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - } - catch (Exception e){ - policyLogger.error("Exception Occured"+e); - } - } - - @RequestMapping(value={"/get_DashboardSystemAlertData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) - public void getSystemAlertData(HttpServletRequest request, HttpServletResponse response){ - try{ - Map model = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); - model.put("systemAlertsTableDatas", mapper.writeValueAsString(systemDAO.getSystemAlertData())); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - } - catch (Exception e){ - policyLogger.error("Exception Occured"+e); - } - } - - @RequestMapping(value={"/get_DashboardPAPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) - public void getPAPStatusData(HttpServletRequest request, HttpServletResponse response){ - try{ - Map model = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - addPAPToTable(); - model.put("papTableDatas", mapper.writeValueAsString(papStatusData)); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - } - catch (Exception e){ - policyLogger.error("Exception Occured"+e); - } - } - - @RequestMapping(value={"/get_DashboardPDPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) - public void getPDPStatusData(HttpServletRequest request, HttpServletResponse response){ - try{ - Map model = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - PolicyController controller = getPolicyControllerInstance(); - this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); - addPDPToTable(); - model.put("pdpTableDatas", mapper.writeValueAsString(pdpStatusData)); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - } - catch (Exception e){ - policyLogger.error("Exception Occured"+e); - } - } - - @RequestMapping(value={"/get_DashboardPolicyActivityData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) - public void getPolicyActivityData(HttpServletRequest request, HttpServletResponse response){ - try{ - Map model = new HashMap<>(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - PolicyController controller = getPolicyControllerInstance(); - this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); - addPolicyToTable(); - model.put("policyActivityTableDatas", mapper.writeValueAsString(policyActivityData)); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - } - catch (Exception e){ - policyLogger.error("Exception Occured"+e); - } - } - - /* - * Add the PAP information to the PAP Table - */ - public void addPAPToTable(){ - papStatusData = new ArrayList<>(); - String papStatus = null; - try { - PolicyController controller = getPolicyControllerInstance(); - Set groups = controller.getPapEngine().getOnapPDPGroups(); - if (groups == null) { - throw new PAPException("PAP not running"); - }else { - papStatus = "IS_OK"; - } - } catch (PAPException | NullPointerException e1) { - papStatus = "CANNOT_CONNECT"; - policyLogger.error("Error getting PAP status, PAP not responding to requests", e1); - } - String papURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL); - JSONObject object = new JSONObject(); - object.put("system", papURL); - object.put("status", papStatus); - List data = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); - object.put("noOfPolicy", data.size()); - object.put("noOfConnectedTrap", pdpCount); - papStatusData.add(0, object); - } - - /** - * Add PDP Information to the PDP Table - * - */ - public void addPDPToTable(){ - pdpCount = 0; - pdpStatusData = new ArrayList<>(); - long naCount; - long denyCount = 0; - long permitCount = 0; - for (PDPGroup group : this.pdpConatiner.getGroups()){ - for (PDP pdp : group.getPdps()){ - naCount = -1; - if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((OnapPDP) pdp).getJmxPort() != 0){ - String pdpIpAddress = parseIPSystem(pdp.getId()); - int port = ((OnapPDP) pdp).getJmxPort(); - if (port != 0){ - policyLogger.debug("Getting JMX Response Counts from " + pdpIpAddress + " at JMX port " + port); - naCount = getRequestCounts(pdpIpAddress, port, "pdpEvaluationNA"); - permitCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationPermit"); - denyCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationDeny"); - } - } - if (naCount == -1){ - JSONObject object = new JSONObject(); - object.put("id", pdp.getId()); - object.put("name", pdp.getName()); - object.put("groupname", group.getName()); - object.put("status", pdp.getStatus().getStatus().toString()); - object.put("description", pdp.getDescription()); - object.put("permitCount", "NA"); - object.put("denyCount", "NA"); - object.put("naCount", "NA"); - pdpStatusData.add(object); - }else{ - JSONObject object = new JSONObject(); - object.put("id", pdp.getId()); - object.put("name", pdp.getName()); - object.put("groupname", group.getName()); - object.put("status", pdp.getStatus().getStatus().toString()); - object.put("description", pdp.getDescription()); - object.put("permitCount", permitCount); - object.put("denyCount", denyCount); - object.put("naCount", naCount); - pdpStatusData.add(object); - } - pdpCount++; - } - } - } - - private static String parseIPSystem(String line) { - Pattern pattern = Pattern.compile("://(.+?):"); - Matcher ip = pattern.matcher(line); - if (ip.find()) - { - return ip.group(1); - } - return null; - } - - /* - * Contact JMX Connector Sever and return the value of the given jmxAttribute - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private long getRequestCounts(String host, int port, String jmxAttribute) { - - policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server"); - HashMap map = null; - try (JMXConnector jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map)){ - jmxConnection.connect(); - Object o = jmxConnection.getMBeanServerConnection().getAttribute(new ObjectName("PdpRest:type=PdpRestMonitor"), jmxAttribute); - policyLogger.debug("pdpEvaluationNA value retreived: " + o); - return (long) o; - } catch (MalformedURLException e) { - policyLogger.error("MalformedURLException for JMX connection" , e); - } catch (IOException e) { - policyLogger.error("Error in reteriving" + jmxAttribute + " from JMX connection", e); - } catch (AttributeNotFoundException e) { - policyLogger.error("AttributeNotFoundException " + jmxAttribute + " for JMX connection", e); - } catch (InstanceNotFoundException e) { - policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e); - } catch (MalformedObjectNameException e) { - policyLogger.error("MalformedObjectNameException for JMX connection", e); - } catch (MBeanException e) { - policyLogger.error("MBeanException for JMX connection"); - policyLogger.error("Exception Occured"+e); - } catch (ReflectionException e) { - policyLogger.error("ReflectionException for JMX connection", e); - } - - return -1; - } - - private static JMXServiceURL createConnectionURL(String host, int port) throws MalformedURLException{ - return new JMXServiceURL("rmi", "", 0, "/jndi/rmi://" + host + ":" + port + "/jmxrmi"); - } - - - /* - * Add the information to the Policy Table - */ - private void addPolicyToTable() { - policyActivityData = new ArrayList<>(); - String policyID; - int policyFireCount; - Map policyMap = new HashMap<>(); - Object policyList; - //get list of policy - - for (PDPGroup group : this.pdpConatiner.getGroups()){ - for (PDPPolicy policy : group.getPolicies()){ - try{ - policyMap.put(policy.getPolicyId().replace(" ", ""), policy.getId()); - }catch(Exception e){ - policyLogger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID+policy.getName() +e); - } - } - - for (PDP pdp : group.getPdps()){ - // Add rows to the Policy Table - policyList = null; - if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((OnapPDP) pdp).getJmxPort() != 0){ - String pdpIpAddress = parseIPSystem(pdp.getId()); - policyList = getPolicy(pdpIpAddress, ((OnapPDP) 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 && 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(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(object); - } - } - } - } - } - - /* - * Contact JMX Connector Sever and return the list of {policy id , count} - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private Object getPolicy(String host, int port, String jmxAttribute){ - policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server for Policy: " + host); - HashMap map = null; - try (JMXConnector jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map)) { - jmxConnection.connect(); - Object o = jmxConnection.getMBeanServerConnection().getAttribute(new ObjectName("PdpRest:type=PdpRestMonitor"), "policyMap"); - policyLogger.debug("policyMap value retreived: " + o); - return o; - } catch (MalformedURLException e) { - policyLogger.error("MalformedURLException for JMX connection" , e); - } catch (IOException e) { - policyLogger.error("AttributeNotFoundException for policyMap" , e); - } catch (AttributeNotFoundException e) { - policyLogger.error("AttributeNotFoundException for JMX connection", e); - } catch (InstanceNotFoundException e) { - policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e); - } catch (MalformedObjectNameException e) { - policyLogger.error("MalformedObjectNameException for JMX connection", e); - } catch (MBeanException e) { - policyLogger.error("MBeanException for JMX connection", e); - policyLogger.error("Exception Occured"+e); - } catch (ReflectionException e) { - policyLogger.error("ReflectionException for JMX connection", e); - } - - return null; - - } - - private static String urnPolicyID(String line){ - String[] splitLine = line.split("="); - String removeSpaces = splitLine[0].replaceAll("\\s+", ""); - return removeSpaces.replace("{", ""); - } - - private static Integer countPolicyID(String line){ - String[] splitLine = line.split("="); - String sCount = splitLine[1].replace("}", ""); - return Integer.parseInt(sCount); - } +public class DashboardController extends RestrictedBaseController { + private static final Logger policyLogger = FlexLogger.getLogger(DashboardController.class); + @Autowired + CommonClassDao commonClassDao; + + @Autowired + SystemLogDbDao systemDAO; + + public void setCommonClassDao(CommonClassDao commonClassDao) { + this.commonClassDao = commonClassDao; + } + + public void setSystemLogDbDao(SystemLogDbDao systemDAO) { + this.systemDAO = systemDAO; + } + + private int pdpCount; + private PDPGroupContainer pdpConatiner; + private ArrayList pdpStatusData; + private ArrayList papStatusData; + private ArrayList policyStatusCrudData; + private ArrayList pdpStatusCrudData; + private ArrayList policyActivityData; + private PolicyController policyController; + private static String defaultTime = "0000-00-00"; + private static String createDate = "createdDate"; + private static String modifiedDate = "modifiedDate"; + private static String scope = "scope"; + private static String stage = "stage"; + private static String exceptionOccured = "Exception Occured"; + + public PolicyController getPolicyController() { + return policyController; + } + + public void setPolicyController(PolicyController policyController) { + this.policyController = policyController; + } + + private PolicyController getPolicyControllerInstance() { + return policyController != null ? getPolicyController() : new PolicyController(); + } + + + + /** + * This method is to retrieve all the data of last 30 days from PolicyEntity table as default. + * + * @param request object + * @param response object contains retrieved data + */ + @RequestMapping(value = {"/get_DashboardPolicyCRUDData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void get_DashboardPolicyCrudData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + addPolicyCrudInfoToTable(); + model.put("papStatusCRUDData", mapper.writeValueAsString(policyStatusCrudData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured, e); + } + } + + /** + * This method retrieves data based on input criteria. + * + * @param request object + * @param response object contains retrieved data + */ + @RequestMapping(value = {"/dashboardController/dashboardAdvancedSearch.htm"}, + method = {org.springframework.web.bind.annotation.RequestMethod.POST}) + public void dashboardAdvancedSearch(HttpServletRequest request, HttpServletResponse response) throws IOException { + String lscope = null; + String lstage = "both"; + String isDelected = "both"; + String ttlDateAfter = null; + String ttlDateBefore = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + JsonNode root = mapper.readTree(request.getReader()); + JsonNode inputData = root.get("policyData"); + JsonNode jscope = inputData.path(scope); + if (jscope != null) { + lscope = jscope.textValue(); + } + JsonNode jstage = inputData.path(stage); + if (jstage != null) { + lstage = jstage.textValue(); + } + JsonNode jisDelected = inputData.path("isDelected"); + if (jisDelected != null) { + isDelected = jisDelected.textValue(); + } + JsonNode jttlDateAfter = inputData.path("ttlDate_after"); + if (jttlDateAfter != null) { + ttlDateAfter = jttlDateAfter.textValue(); + } + JsonNode jttlDateBefore = inputData.path("ttlDate_before"); + if (jttlDateBefore != null) { + ttlDateBefore = jttlDateBefore.textValue(); + } + getPolicyData(lscope, lstage, isDelected, ttlDateAfter, ttlDateBefore); + Map model = new HashMap<>(); + model.put("policyStatusCRUDData", mapper.writeValueAsString(policyStatusCrudData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(PolicyUtils.CATCH_EXCEPTION); + } + + } + + /** + * This method is to retrieve data from PolicyEntity table. + * + * @param request object + * @param response object contains retrieved data + */ + @RequestMapping(value = {"/get_DashboardPdpPolicyCRUDData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void get_DashboardPdpPolicyCrudData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + model.put("pdpStatusCRUDData", mapper.writeValueAsString(pdpStatusCrudData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured, e); + } + } + + @RequestMapping(value = {"/get_DashboardLoggingData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void getData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + model.put("availableLoggingDatas", mapper.writeValueAsString(systemDAO.getLoggingData())); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + } + + @RequestMapping(value = {"/get_DashboardSystemAlertData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void getSystemAlertData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + model.put("systemAlertsTableDatas", mapper.writeValueAsString(systemDAO.getSystemAlertData())); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + } + + @RequestMapping(value = {"/get_DashboardPAPStatusData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void getPAPStatusData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + addPAPToTable(); + model.put("papTableDatas", mapper.writeValueAsString(papStatusData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + } + + @RequestMapping(value = {"/get_DashboardPDPStatusData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void getPDPStatusData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + PolicyController controller = getPolicyControllerInstance(); + this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); + addPDPToTable(); + model.put("pdpTableDatas", mapper.writeValueAsString(pdpStatusData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + } + + @RequestMapping(value = {"/get_DashboardPolicyActivityData"}, + method = {org.springframework.web.bind.annotation.RequestMethod.GET}, + produces = MediaType.APPLICATION_JSON_VALUE) + public void getPolicyActivityData(HttpServletRequest request, HttpServletResponse response) { + try { + Map model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); + PolicyController controller = getPolicyControllerInstance(); + this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); + addPolicyToTable(); + model.put("policyActivityTableDatas", mapper.writeValueAsString(policyActivityData)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + } + + /* + * Add the PAP information to the PAP Table + */ + public void addPAPToTable() { + papStatusData = new ArrayList<>(); + String papStatus = null; + try { + PolicyController controller = getPolicyControllerInstance(); + Set groups = controller.getPapEngine().getOnapPDPGroups(); + if (groups == null) { + throw new PAPException("PAP not running"); + } else { + papStatus = "IS_OK"; + } + } catch (PAPException | NullPointerException e1) { + papStatus = "CANNOT_CONNECT"; + policyLogger.error("Error getting PAP status, PAP not responding to requests", e1); + } + String papURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL); + JSONObject object = new JSONObject(); + object.put("system", papURL); + object.put("status", papStatus); + List data = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); + object.put("noOfPolicy", data.size()); + object.put("noOfConnectedTrap", pdpCount); + papStatusData.add(0, object); + } + + + /* + * Add the PAP Policy information to the PAP Table + */ + public void addPolicyCrudInfoToTable() { + policyStatusCrudData = new ArrayList<>(); + LocalDate now = LocalDate.now(); + LocalDate lastThirtyDate = now.minusDays(30); + policyLogger.info("now: " + now); + policyLogger.info("thirty: " + lastThirtyDate); + String entityquery = "from PolicyEntity where created_date >= :createdDate"; + SimpleBindings geParams = new SimpleBindings(); + geParams.put(createDate, lastThirtyDate.toString()); + List datas = commonClassDao.getDataByQuery(entityquery, geParams); + + if (datas == null) { + return; + } + + datas.stream().forEach((data) -> { + JSONObject object = new JSONObject(); + object.put("id", ((PolicyEntity) data).getPolicyId()); + object.put(scope, ((PolicyEntity) data).getScope()); + object.put("policyName", ((PolicyEntity) data).getPolicyName()); + object.put("version", ((PolicyEntity) data).getVersion()); + if (isPushedToPDP(((PolicyEntity) data).getPolicyId())) { + object.put(stage, "PDP"); + } else { + object.put(stage, "PAP"); + } + object.put("createdBy", ((PolicyEntity) data).getCreatedBy()); + object.put("deleted", ((PolicyEntity) data).isDeleted()); + object.put("deleteReasonCode", ((PolicyEntity) data).getDeleteReasonCode()); + object.put("deletedBy", ((PolicyEntity) data).getDeletedBy()); + object.put("modifiedBy", ((PolicyEntity) data).getModifiedBy()); + if (((PolicyEntity) data).getModifiedDate() != null) { + Timestamp ts = new Timestamp(((PolicyEntity) data).getModifiedDate().getTime()); + Timestamp cts = new Timestamp(((PolicyEntity) data).getCreatedDate().getTime()); + object.put(modifiedDate, ts.toString()); + object.put(createDate, cts.toString()); + } else { + object.put(modifiedDate, defaultTime); + object.put(createDate, defaultTime); + } + policyStatusCrudData.add(object); + }); + } + + /* + * Add the PDP Policy information to the PDP Table + */ + private boolean isPushedToPDP(long policyId) { + try { + String groupEntityquery = "from PolicyGroupEntity where policyid = :policyEntityId"; + SimpleBindings geParams = new SimpleBindings(); + geParams.put("policyEntityId", policyId); + List groupobject = commonClassDao.getDataByQuery(groupEntityquery, geParams); + if (groupobject != null && groupobject.size() > 0) { + return true; + } + } catch (Exception e) { + policyLogger.error(exceptionOccured + e); + } + + return false; + } + + /* + * Add the Policy information to the policyStatusCRUDDataTable + */ + private void getPolicyData(String inputScope, String inputStage, String isDeleted, String createdAfter, String createdBefore) { + policyStatusCrudData = new ArrayList<>(); + List policyData = null; + SimpleBindings geParams = new SimpleBindings(); + try { + StringBuilder entityquery = buildSqlQuery(inputScope, isDeleted, createdAfter, createdBefore); + if (entityquery == null) { + return; + } + policyLogger.info("entityquery: " + entityquery.toString()); + policyLogger.info("geParams: " + geParams.toString()); + + policyData = commonClassDao.getDataByQuery(entityquery.toString(), geParams); + if (policyData == null) { + return; + } + policyData.stream().forEach((data) -> { + JSONObject object = populatePolicyData((PolicyEntity) data); + + if (object.get(stage).equals("PDP") && "PDP".equalsIgnoreCase(inputStage)) { + policyStatusCrudData.add(object); + } + if (object.get(stage).equals("PAP") && "PAP".equalsIgnoreCase(inputStage)) { + policyStatusCrudData.add(object); + } + if ("both".equalsIgnoreCase(inputStage)) { + policyStatusCrudData.add(object); + } + }); + } catch (Exception e) { + policyLogger.error(exceptionOccured, e); + } + } + + /* + * Build SQL query + */ + private StringBuilder buildSqlQuery(String scope, String isDeleted, String createdAfter, String createdBefore) { + SimpleBindings geParams = new SimpleBindings(); + + // since scope is required + if (scope == null || scope.isEmpty()) { + return null; + } else { + geParams.put(scope, "%" + scope + "%"); + } + StringBuilder entityquery = new StringBuilder("from PolicyEntity where scope like :scope "); + if (!"both".equalsIgnoreCase(isDeleted)) { + entityquery.append(" and deleted = :isDeleted"); + if ("Yes".equalsIgnoreCase(isDeleted)) { + geParams.put("isDeleted", true); + } else { + geParams.put("isDeleted", false); + } + } + if (createdAfter != null && !createdAfter.isEmpty()) { + entityquery.append(" and created_date >= :createdAfter"); + geParams.put("createdAfter", createdAfter); + } + if (createdBefore != null && !createdBefore.isEmpty()) { + entityquery.append(" and created_date <= :createdBefore"); + geParams.put("createdBefore", createdBefore); + } + return entityquery; + } + + private JSONObject populatePolicyData(PolicyEntity data) { + JSONObject object = new JSONObject(); + object.put("id", data.getPolicyId()); + object.put(scope, data.getScope()); + object.put("policyName", data.getPolicyName()); + object.put("version", data.getVersion()); + if (isPushedToPDP(data.getPolicyId())) { + object.put(stage, "PDP"); + } else { + object.put(stage, "PAP"); + } + object.put("createdBy", data.getCreatedBy()); + object.put("deleted", data.isDeleted()); + object.put("deleteReasonCode", data.getDeleteReasonCode()); + object.put("deletedBy", data.getDeletedBy()); + object.put("modifiedBy", data.getModifiedBy()); + if (data.getModifiedDate() != null) { + Timestamp ts = new Timestamp(data.getModifiedDate().getTime()); + Timestamp cts = new Timestamp(data.getCreatedDate().getTime()); + object.put(modifiedDate, ts.toString()); + object.put(createDate, cts.toString()); + } else { + object.put(modifiedDate, defaultTime); + object.put(createDate, defaultTime); + } + + return object; + } + + /** + * Add PDP Information to the PDP Table + * + */ + public void addPDPToTable() { + pdpCount = 0; + pdpStatusData = new ArrayList<>(); + long naCount; + long denyCount = 0; + long permitCount = 0; + for (PDPGroup group : this.pdpConatiner.getGroups()) { + for (PDP pdp : group.getPdps()) { + naCount = -1; + if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((OnapPDP) pdp).getJmxPort() != 0) { + String pdpIpAddress = parseIPSystem(pdp.getId()); + int port = ((OnapPDP) pdp).getJmxPort(); + if (port != 0) { + policyLogger.debug("Getting JMX Response Counts from " + pdpIpAddress + " at JMX port " + port); + naCount = getRequestCounts(pdpIpAddress, port, "pdpEvaluationNA"); + permitCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationPermit"); + denyCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationDeny"); + } + } + if (naCount == -1) { + JSONObject object = new JSONObject(); + object.put("id", pdp.getId()); + object.put("name", pdp.getName()); + object.put("groupname", group.getName()); + object.put("status", pdp.getStatus().getStatus().toString()); + object.put("description", pdp.getDescription()); + object.put("permitCount", "NA"); + object.put("denyCount", "NA"); + object.put("naCount", "NA"); + pdpStatusData.add(object); + } else { + JSONObject object = new JSONObject(); + object.put("id", pdp.getId()); + object.put("name", pdp.getName()); + object.put("groupname", group.getName()); + object.put("status", pdp.getStatus().getStatus().toString()); + object.put("description", pdp.getDescription()); + object.put("permitCount", permitCount); + object.put("denyCount", denyCount); + object.put("naCount", naCount); + pdpStatusData.add(object); + } + pdpCount++; + } + } + } + + private static String parseIPSystem(String line) { + Pattern pattern = Pattern.compile("://(.+?):"); + Matcher ip = pattern.matcher(line); + if (ip.find()) { + return ip.group(1); + } + return null; + } + + /* + * Contact JMX Connector Sever and return the value of the given jmxAttribute + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + private long getRequestCounts(String host, int port, String jmxAttribute) { + + policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server"); + HashMap map = null; + try (JMXConnector jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map)) { + jmxConnection.connect(); + Object o = + jmxConnection.getMBeanServerConnection().getAttribute( + new ObjectName("PdpRest:type=PdpRestMonitor"), jmxAttribute); + policyLogger.debug("pdpEvaluationNA value retreived: " + o); + return (long) o; + } catch (MalformedURLException e) { + policyLogger.error("MalformedURLException for JMX connection", e); + } catch (IOException e) { + policyLogger.error("Error in reteriving" + jmxAttribute + " from JMX connection", e); + } catch (AttributeNotFoundException e) { + policyLogger.error("AttributeNotFoundException " + jmxAttribute + " for JMX connection", e); + } catch (InstanceNotFoundException e) { + policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e); + } catch (MalformedObjectNameException e) { + policyLogger.error("MalformedObjectNameException for JMX connection", e); + } catch (MBeanException e) { + policyLogger.error("MBeanException for JMX connection"); + policyLogger.error(exceptionOccured + e); + } catch (ReflectionException e) { + policyLogger.error("ReflectionException for JMX connection", e); + } + + return -1; + } + + private static JMXServiceURL createConnectionURL(String host, int port) throws MalformedURLException { + return new JMXServiceURL("rmi", "", 0, "/jndi/rmi://" + host + ":" + port + "/jmxrmi"); + } + + + /* + * Add the information to the Policy Table + */ + private void addPolicyToTable() { + policyActivityData = new ArrayList<>(); + String policyID; + int policyFireCount; + Map policyMap = new HashMap<>(); + Object policyList; + // get list of policy + + for (PDPGroup group : this.pdpConatiner.getGroups()) { + for (PDPPolicy policy : group.getPolicies()) { + try { + policyMap.put(policy.getPolicyId().replace(" ", ""), policy.getId()); + } catch (Exception e) { + policyLogger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + policy.getName() + e); + } + } + + for (PDP pdp : group.getPdps()) { + // Add rows to the Policy Table + policyList = null; + if ("UP_TO_DATE".equals(pdp.getStatus().getStatus().toString()) && ((OnapPDP) pdp).getJmxPort() != 0) { + String pdpIpAddress = parseIPSystem(pdp.getId()); + policyList = getPolicy(pdpIpAddress, ((OnapPDP) 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 && 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(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(object); + } + } + } + } + } + + /* + * Contact JMX Connector Sever and return the list of {policy id , count} + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + private Object getPolicy(String host, int port, String jmxAttribute) { + policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server for Policy: " + + host); + HashMap map = null; + try (JMXConnector jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map)) { + jmxConnection.connect(); + Object o = + jmxConnection.getMBeanServerConnection().getAttribute( + new ObjectName("PdpRest:type=PdpRestMonitor"), "policyMap"); + policyLogger.debug("policyMap value retreived: " + o); + return o; + } catch (MalformedURLException e) { + policyLogger.error("MalformedURLException for JMX connection", e); + } catch (IOException e) { + policyLogger.error("AttributeNotFoundException for policyMap", e); + } catch (AttributeNotFoundException e) { + policyLogger.error("AttributeNotFoundException for JMX connection", e); + } catch (InstanceNotFoundException e) { + policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e); + } catch (MalformedObjectNameException e) { + policyLogger.error("MalformedObjectNameException for JMX connection", e); + } catch (MBeanException e) { + policyLogger.error("MBeanException for JMX connection", e); + policyLogger.error(exceptionOccured + e); + } catch (ReflectionException e) { + policyLogger.error("ReflectionException for JMX connection", e); + } + + return null; + + } + + private static String urnPolicyID(String line) { + String[] splitLine = line.split("="); + String removeSpaces = splitLine[0].replaceAll("\\s+", ""); + return removeSpaces.replace("{", ""); + } + + private static Integer countPolicyID(String line) { + String[] splitLine = line.split("="); + String sCount = splitLine[1].replace("}", ""); + return Integer.parseInt(sCount); + } } diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js new file mode 100644 index 000000000..ce1af6b1a --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dashboardCRUDController.js @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Engine + * ================================================================================ + * Copyright (C) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +app.controller('policyDashboardCRUDDataController', function ($scope, PolicyAppService, modalService, $modal){ + console.log("policyDashboardCRUDDataController called"); + + $('#dashBoardAdvanceSearch').hide(); + + $scope.papCRUDTableDatasTemp = []; + + $scope.dashboardAdsearch = { isDelected: 'both', stage: 'both', scope: "", ttlDate_after: "", ttlDate_before: ""}; + + PolicyAppService.getData('get_DashboardPolicyCRUDData').then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.papStatusCRUDDatas =JSON.parse($scope.data.papStatusCRUDData); + if($scope.papStatusCRUDDatas != null){ + for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){ + $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map); + } + + $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp; + } + + },function(error){ + console.log("failed"); + }); + + $scope.papCRUDStatusDatas = { + data : 'papCRUDTableDatas', + enableFiltering: true, + columnDefs: [{ field: 'id', displayName :'id'}, + {field: 'scope', displayName :'Scope'}, + {field: 'policyName', displayName :'Policy Name'}, + {field: 'version', displayName :'Version'}, + {field: 'stage', displayName :'Stage'}, + {field: 'createdBy', displayName :'Created By'}, + {field: 'deleted', displayName :'Deleted'}, + {field: 'deleteReasonCode', displayName :'Deleted Reason'}, + {field: 'deletedBy' , displayName :'Deleted By'}, + {field: 'modifiedBy' , displayName :'Modified By'}, + {field: 'createdDate', displayName :'Created Date'}, + {field: 'modifiedDate', displayName :'Modified Date'} + ], + onRegisterApi: function(gridApi){ + $scope.gridApi = gridApi; + } + }; + + $('#ttlDate_after').datepicker({ + dateFormat: 'yy-mm-dd', + changeMonth: true, + changeYear: true, + onSelect: function(date) { + angular.element($('#ttlDate_after')).triggerHandler('input'); + } + }); + + $('#ttlDate_before').datepicker({ + dateFormat: 'yy-mm-dd', + changeMonth: true, + changeYear: true, + onSelect: function(date) { + angular.element($('#ttlDate_before')).triggerHandler('input'); + } + }); + + $scope.refresh = function(){ + $scope.modal('advancedSearch', true); + $scope.temp.policy = ""; + }; + + + $scope.advancedSearch = function(){ + + $('#dashBoardAdvanceSearch').toggle(); + if($('#advancedSearchArrow').hasClass('arrowdown')){ + $('#advancedSearchArrow').removeClass("arrowdown"); + $('#advancedSearchArrow').addClass("arrowup"); + + }else{ + $('#advancedSearchArrow').removeClass("arrowup"); + $('#advancedSearchArrow').addClass("arrowdown"); + } + } + + + $scope.startAdvancedSearch = function(data){ + + console.log("startAdvancedSearch called"); + console.log(data.isDelected); + console.log(data.stage); + console.log(data.scope); + console.log(data.ttlDate_after); + console.log(data.ttlDate_before); + + if(data.scope == null){ + return; + } + + var uuu = "dashboardController/dashboardAdvancedSearch.htm"; + + var postData={policyData: data}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + console.log("dashboardAdvancedSearch data returned: " + data); + + $scope.$apply(function(){ + + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.papStatusCRUDDatas =JSON.parse($scope.data.policyStatusCRUDData); + + $scope.papCRUDTableDatasTemp = []; + + for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){ + $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map); + } + + $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp; + + $scope.gridApi.grid.refresh(); + }); + }, + error : function(data){ + console.log("dashboardAdvancedSearch Failed: data returned as " + data); + } + }); + }; + +}); \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js index a340c6764..702a54366 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/policyController.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -53,6 +53,10 @@ app.config(function($routeProvider) { templateUrl: 'app/policyApp/policy-models/policy_DashboardHealth.html', controller : "policyDashboardHealthController" }) + .when('/Dashboard_crud', { + templateUrl: 'app/policyApp/policy-models/policy_DashboardCRUD.html', + controller : "policyDashboardCRUDDataController" + }) .when('/policy_SearchFilter', { templateUrl: 'app/policyApp/policy-models/policy_SearchFilter.html', controller : "PolicySearchController" diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html index 9be8d015a..430907a65 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html @@ -100,6 +100,7 @@ + diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css index 850adb338..d7c98b98c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -469,4 +469,85 @@ table th > a:focus { .mstooltip:hover .tooltiptext { visibility: visible; +} + + +.msloader { + border: 6px solid #a94442; + border-top: 6px solid #3498db; /* Blue */ + border-radius: 50%; + width: 60px; + height: 60px; + animation: spin 2s linear infinite; +} + + +@-webkit-keyframes spin { + 0% { -webkit-transform: rotate(0deg); } + 100% { -webkit-transform: rotate(360deg); } +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +#msPolicyloader { + display:block; + background-color:#c0c0c0; + width:20px; + height: 20px; + margin-left: 5px; +} + +#msVersion { + width: 195px; + height: 20px; + border: 0px; + display: -webkit-flex; /* Safari */ + -webkit-flex-flow: row-reverse wrap; /* Safari 6.1+ */ + display: flex; + flex-flow: row-reverse wrap; +} + +#advancedSearch i { + border: solid black; + border-width: 0 1px 1px 0; + display: inline-block; + padding: 3px; + margin-left:20px; +} +.arrowright { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); +} + +.arrowleft { + transform: rotate(135deg); + -webkit-transform: rotate(135deg); +} + +.arrowup { + transform: rotate(-135deg); + -webkit-transform: rotate(-135deg); +} + +.arrowdown { + transform: rotate(45deg); + -webkit-transform: rotate(45deg); +} + +#dashBoardAdvanceSearch .well { + padding-bottom: 5px; +} + +#dashBoardAdvanceSearch button { + float: left; + padding-bottom: 10px; + background: #f5f5f5; + color: black; + font-size: 22px; + border: 0px solid grey; + border-left: none; + cursor: pointer; } \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardCRUD.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardCRUD.html new file mode 100644 index 000000000..cb02a1ca8 --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardCRUD.html @@ -0,0 +1,99 @@ + + +
+
+

Policy Status Info

+
+ +
+
+
+
+ + + +
+
+
+ Advanced Search +
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+

Policies were retrieved for last 30 days...

+

+
+
+ + \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardHealth.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardHealth.html index 5fbdf528d..046643ea5 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardHealth.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardHealth.html @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -19,7 +19,7 @@ */-->
-

Policy Engine Health

+

Policy Engine Health

@@ -31,6 +31,8 @@ onClick="window.location='policy#/Dashboard';">Logging +

diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardLogging.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardLogging.html index a42427fb5..8ec80dcba 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardLogging.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_DashboardLogging.html @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -19,7 +19,7 @@ */-->
-

Dashboard Logging

+

Dashboard Logging

@@ -31,6 +31,8 @@ onClick="window.location='policy#/Dashboard';">Logging +

-- cgit 1.2.3-korg