summaryrefslogtreecommitdiffstats
path: root/gui-pdp-monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'gui-pdp-monitoring')
-rw-r--r--gui-pdp-monitoring/pom.xml34
-rw-r--r--gui-pdp-monitoring/src/main/assembly/frontend.xml (renamed from gui-pdp-monitoring/src/main/assembly/resources.xml)12
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java2
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java19
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java7
-rw-r--r--gui-pdp-monitoring/src/webapp/js/MonitoringConfig.js5
-rw-r--r--gui-pdp-monitoring/src/webapp/js/MonitoringMain.js8
-rw-r--r--gui-pdp-monitoring/src/webapp/js/MonitoringUtils.js7
-rw-r--r--gui-pdp-monitoring/src/webapp/js/PdpListView.js13
-rw-r--r--gui-pdp-monitoring/src/webapp/webpack.config.js5
10 files changed, 40 insertions, 72 deletions
diff --git a/gui-pdp-monitoring/pom.xml b/gui-pdp-monitoring/pom.xml
index 4fe4491..4f9b72c 100644
--- a/gui-pdp-monitoring/pom.xml
+++ b/gui-pdp-monitoring/pom.xml
@@ -1,6 +1,6 @@
<!--
============LICENSE_START=======================================================
- Copyright (C) 2020 Nordix Foundation.
+ Copyright (C) 2020-2021 Nordix Foundation.
Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,19 +63,6 @@
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.gui</groupId>
- <artifactId>gui-common</artifactId>
- <version>${project.version}</version>
- <classifier>resources</classifier>
- <type>zip</type>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
@@ -131,22 +118,19 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>Copy frontend build to target</id>
- <phase>prepare-package</phase>
+ <id>generate-gui-pdp-monitoring-tar</id>
+ <phase>package</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
- <resources>
- <resource>
- <directory>${webapp.dir}/dist</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
+ <descriptors>
+ <descriptor>src/main/assembly/frontend.xml</descriptor>
+ </descriptors>
+ <finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</execution>
</executions>
diff --git a/gui-pdp-monitoring/src/main/assembly/resources.xml b/gui-pdp-monitoring/src/main/assembly/frontend.xml
index b204cab..610121b 100644
--- a/gui-pdp-monitoring/src/main/assembly/resources.xml
+++ b/gui-pdp-monitoring/src/main/assembly/frontend.xml
@@ -1,6 +1,6 @@
<!--
============LICENSE_START=======================================================
- Copyright (C) 2020 Nordix Foundation.
+ Copyright (C) 2020-2021 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,15 +18,15 @@
============LICENSE_END=========================================================
-->
<assembly>
- <id>resources</id>
+ <id>frontend</id>
<formats>
- <format>zip</format>
+ <format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
- <directory>target/classes/webapp</directory>
- <outputDirectory>monitoring</outputDirectory>
+ <directory>${webapp.dir}/dist</directory>
+ <outputDirectory>pdp-monitoring</outputDirectory>
</fileSet>
</fileSets>
-</assembly> \ No newline at end of file
+</assembly>
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
index 398cbc4..2c0bb3a 100644
--- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
+++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
@@ -152,7 +152,7 @@ public class PdpMonitoringMain {
public void shutdown() {
if (pdpMonitoringServer != null) {
LOGGER.info(PDP_MONITORING_PREFIX + "{}) shutting down", this);
- pdpMonitoringServer.shutdown(parameters.getPort(), parameters.getDefaultRestPort());
+ pdpMonitoringServer.shutdown(parameters.getPort());
}
shutdownLatch.countDown();
state = ServicesState.STOPPED;
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java
index 78e048d..bfb273d 100644
--- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java
+++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java
@@ -22,7 +22,6 @@
package org.onap.policy.gui.pdp.monitoring;
import lombok.NonNull;
-import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.slf4j.Logger;
@@ -41,9 +40,6 @@ public class PdpMonitoringServer {
// The HTTP server exposing JAX-RS resources defined in this application.
private HttpServletServer jerseyServer;
- // The HTTP server exposing static resources defined in this application.
- private HttpServletServer staticResourceServer;
-
/**
* Starts the HTTP server for the Pdp statistics monitoring on the default base URI and with the
* default REST packages.
@@ -58,34 +54,23 @@ public class PdpMonitoringServer {
* @param parameters The Pdp parameters to use to start the server.
*/
public PdpMonitoringServer(@NonNull final PdpMonitoringServerParameters parameters) {
-
LOGGER.debug("Pdp Monitoring starting . . .");
jerseyServer = HttpServletServerFactoryInstance.getServerFactory().build("PDP Monitoring Rest Server", false,
- parameters.getServerHost(), parameters.getDefaultRestPort(), parameters.getContextPath(), false, true);
+ parameters.getServerHost(), parameters.getPort(), parameters.getContextPath(), false, true);
jerseyServer.addServletPackage(parameters.getDefaultRestPath(), parameters.getRestPackage());
- jerseyServer.addFilterClass(parameters.getDefaultRestPath(), CrossOriginFilter.class.getName());
jerseyServer.start();
- staticResourceServer = HttpServletServerFactoryInstance.getServerFactory().buildStaticResourceServer(
- "PDP Monitoring Html Server", false, parameters.getServerHost(), parameters.getPort(),
- parameters.getContextPath(), true);
- staticResourceServer.addServletResource(null,
- PdpMonitoringServer.class.getClassLoader().getResource("webapp").toExternalForm());
- staticResourceServer.start();
-
LOGGER.debug("Pdp Monitoring started");
}
/**
* Shut down the web server.
*
- * @param htmlPort port number of static resource server
* @param restPort port number of jersey server
*/
- public void shutdown(int htmlPort, int restPort) {
+ public void shutdown(int restPort) {
LOGGER.debug("Pdp Monitoring . . .");
- HttpServletServerFactoryInstance.getServerFactory().destroy(htmlPort);
HttpServletServerFactoryInstance.getServerFactory().destroy(restPort);
LOGGER.debug("Pdp Monitoring shut down");
}
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java
index a76fa02..78fb479 100644
--- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java
+++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java
@@ -38,7 +38,6 @@ import org.onap.policy.common.parameters.annotations.Min;
@Getter
@Setter
public class PdpMonitoringServerParameters {
- public static final int DEFAULT_PORT = 18999;
public static final int INFINITY_TIME_TO_LIVE = -1;
// Base URI the HTTP server will listen on
@@ -55,7 +54,7 @@ public class PdpMonitoringServerParameters {
@Min(1024)
@Max(65534)
- private int port = DEFAULT_PORT;
+ private int port = DEFAULT_REST_PORT;
@Min(-1)
private long timeToLive = INFINITY_TIME_TO_LIVE;
@@ -88,8 +87,4 @@ public class PdpMonitoringServerParameters {
public String getDefaultRestPath() {
return "/" + DEFAULT_REST_PATH;
}
-
- public int getDefaultRestPort() {
- return DEFAULT_REST_PORT;
- }
}
diff --git a/gui-pdp-monitoring/src/webapp/js/MonitoringConfig.js b/gui-pdp-monitoring/src/webapp/js/MonitoringConfig.js
index f929282..6e5200e 100644
--- a/gui-pdp-monitoring/src/webapp/js/MonitoringConfig.js
+++ b/gui-pdp-monitoring/src/webapp/js/MonitoringConfig.js
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
// Configuration used for page layout and charts
const config = {
refresh: 5000,
- restPort: 17999,
engineService: {
parent: "engineService",
tableId: "engineServicesTable",
@@ -124,4 +123,4 @@ const config = {
}
};
-export { config, }; \ No newline at end of file
+export { config, };
diff --git a/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js b/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js
index 9198d63..48aa96c 100644
--- a/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js
+++ b/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,8 +68,8 @@ function readyCallback() {
window.restRootURL = location.protocol
+ "//"
+ window.location.hostname
- + ':' + config.restPort
- + (location.pathname.endsWith("/monitoring/") ? location.pathname.substring(0, location.pathname.indexOf("monitoring/")) : location.pathname)
+ + ':' + window.location.port
+ + window.location.pathname
+ "papservices/monitoring/";
// Initialize tooltip for the charts
initTooltip();
@@ -108,4 +108,4 @@ function readyCallback() {
$(document).ready(readyCallback);
// Export for unit testing
-export { readyCallback, servicesCallback }; \ No newline at end of file
+export { readyCallback, servicesCallback };
diff --git a/gui-pdp-monitoring/src/webapp/js/MonitoringUtils.js b/gui-pdp-monitoring/src/webapp/js/MonitoringUtils.js
index 9c6e076..2f2b044 100644
--- a/gui-pdp-monitoring/src/webapp/js/MonitoringUtils.js
+++ b/gui-pdp-monitoring/src/webapp/js/MonitoringUtils.js
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -309,11 +310,11 @@ function clearEngineURL(clearPdps) {
function getPdpList(data) {
const pdpArray = [];
- for (let i = 0; i < data.groups.length; i++) {
+ for (let value of data.groups) {
var map = {};
- map.title = data.groups[i].name;
+ map.title = value.name;
map.children = [];
- (data.groups[i].pdpSubgroups).forEach((pdpSubgroup, index) => {
+ (value.pdpSubgroups).forEach((pdpSubgroup, index) => {
map.children[index] = {};
map.children[index].title = pdpSubgroup.pdpType;
const instanceId = [];
diff --git a/gui-pdp-monitoring/src/webapp/js/PdpListView.js b/gui-pdp-monitoring/src/webapp/js/PdpListView.js
index 9ae5c23..1e248ce 100644
--- a/gui-pdp-monitoring/src/webapp/js/PdpListView.js
+++ b/gui-pdp-monitoring/src/webapp/js/PdpListView.js
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -26,20 +27,20 @@ function RenderPdpList(treeArr, className) {
var isNode=false
function insertChildren(parentNode, traverseArr, subGroup) {
- for(let i = 0; i < traverseArr.length; i++) {
+ for(let value of traverseArr) {
if(parentNode === root) {
childLevel = 0
}
var currentLi = document.createElement('li')
currentLi.setAttribute('level', childLevel)
- if(traverseArr[i].children && traverseArr[i].children.length > 0) {
+ if(value.children && value.children.length > 0) {
var title = document.createElement('div')
var triangle = document.createElement('i')
var text = document.createElement('p')
currentLi.classList.add('parentNode')
title.classList.add('title')
triangle.classList.add('triangle')
- text.innerText = traverseArr[i].title
+ text.innerText = value.title
title.appendChild(triangle)
title.appendChild(text)
currentLi.appendChild(title)
@@ -48,12 +49,12 @@ function RenderPdpList(treeArr, className) {
if(subGroup !== null){
index+= subGroup+"/"
}
- insertChildren(currentLi, traverseArr[i].children, traverseArr[i].title)
+ insertChildren(currentLi, value.children, value.title)
}else {
var a = document.createElement('a')
- a.setAttribute('href',"#"+index+subGroup+"/"+traverseArr[i].title)
+ a.setAttribute('href',"#"+index+subGroup+"/"+value.title)
a.classList.add('pdps__link')
- a.textContent= traverseArr[i].title
+ a.textContent= value.title
currentLi.appendChild(a)
isNode=true
}
diff --git a/gui-pdp-monitoring/src/webapp/webpack.config.js b/gui-pdp-monitoring/src/webapp/webpack.config.js
index f387ebe..4b1c179 100644
--- a/gui-pdp-monitoring/src/webapp/webpack.config.js
+++ b/gui-pdp-monitoring/src/webapp/webpack.config.js
@@ -10,6 +10,9 @@ module.exports = {
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
- port: 9000
+ port: 9000,
+ proxy: {
+ "/papservices/monitoring": "http://localhost:17999",
+ }
}
};