This is an automated email from the ASF dual-hosted git repository.
jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new a648805 ARTEMIS-3485 Fix web plugin contexts
new ac41908 This closes #3757
a648805 is described below
commit a648805a594e7562c2e8e3c2cfa4b87158df8999
Author: Domenico Francesco Bruscino <[email protected]>
AuthorDate: Thu Sep 16 09:22:51 2021 +0200
ARTEMIS-3485 Fix web plugin contexts
Support custom web plugin contexts defined with the `url` attribute
of the `app` element in bootstrap.xml.
---
.../hawtio/branding/PluginContextListener.java | 2 +-
.../src/main/webapp/plugin/css/activemq.css | 7 -------
.../src/main/webapp/plugin/js/brandingPlugin.js | 18 ++++++++++++++++++
.../artemis-console/src/main/webapp/hawtconfig.json | 10 +++++-----
.../activemq/hawtio/plugin/PluginContextListener.java | 2 +-
5 files changed, 25 insertions(+), 14 deletions(-)
diff --git
a/artemis-hawtio/activemq-branding/src/main/java/org/apache/activemq/hawtio/branding/PluginContextListener.java
b/artemis-hawtio/activemq-branding/src/main/java/org/apache/activemq/hawtio/branding/PluginContextListener.java
index a95fbab..59b1dd7 100644
---
a/artemis-hawtio/activemq-branding/src/main/java/org/apache/activemq/hawtio/branding/PluginContextListener.java
+++
b/artemis-hawtio/activemq-branding/src/main/java/org/apache/activemq/hawtio/branding/PluginContextListener.java
@@ -39,7 +39,7 @@ public class PluginContextListener implements
ServletContextListener {
ServletContext context = servletContextEvent.getServletContext();
plugin = new HawtioPlugin();
- plugin.setContext((String)context.getInitParameter("plugin-context"));
+ plugin.setContext(context.getContextPath());
plugin.setName(context.getInitParameter("plugin-name"));
plugin.setScripts(context.getInitParameter("plugin-scripts"));
plugin.setDomain(null);
diff --git
a/artemis-hawtio/activemq-branding/src/main/webapp/plugin/css/activemq.css
b/artemis-hawtio/activemq-branding/src/main/webapp/plugin/css/activemq.css
index ee50d69..6c93ca7 100644
--- a/artemis-hawtio/activemq-branding/src/main/webapp/plugin/css/activemq.css
+++ b/artemis-hawtio/activemq-branding/src/main/webapp/plugin/css/activemq.css
@@ -82,13 +82,6 @@ svg text {
border-top: 3px solid #B21054;
}
-/* Change the background image for Login page and About modal as well as text
color etc*/
-.pf-c-login, .pf-c-about-modal-box__hero {
- background-image:
url("/activemq-branding/plugin/img/login-screen-background.png");
- background-size: cover;
- --pf-c-form__label--Color: white;
-}
-
.pf-c-login__main {
grid-area: main;
background-color: transparent;
diff --git
a/artemis-hawtio/activemq-branding/src/main/webapp/plugin/js/brandingPlugin.js
b/artemis-hawtio/activemq-branding/src/main/webapp/plugin/js/brandingPlugin.js
index cc33a84..70c1505 100644
---
a/artemis-hawtio/activemq-branding/src/main/webapp/plugin/js/brandingPlugin.js
+++
b/artemis-hawtio/activemq-branding/src/main/webapp/plugin/js/brandingPlugin.js
@@ -19,6 +19,7 @@
*/
var Branding = (function (Branding) {
+
/**
* The name of this plugin
*/
@@ -33,6 +34,11 @@ var Branding = (function (Branding) {
* The top level path of this plugin on the server
*/
Branding.contextPath = '/activemq-branding';
+ $.get("plugin", (data) => {
+ if (data.hasOwnProperty('activemq-branding')) {
+ Branding.contextPath = data['activemq-branding'].Context;
+ }
+ });
/**
* This plugin's AngularJS module instance.
@@ -80,6 +86,18 @@ var Branding = (function (Branding) {
// favicon settings
Core.applyBranding(configManager);
+ brandingStyle = `
+ <style type='text/css'>
+ /* Change the background image for Login page and About modal as well
as text color etc */
+ .pf-c-login, .pf-c-about-modal-box__hero {
+ background-image:
url("${Branding.contextPath}/plugin/img/login-screen-background.png");
+ background-size: cover;
+ --pf-c-form__label--Color: white;
+ }
+ </style>
+ `;
+ $(brandingStyle).appendTo("head");
+
Branding.log.info(Branding.pluginName, "loaded");
}
initPlugin.$inject = ['configManager', 'aboutService'];
diff --git a/artemis-hawtio/artemis-console/src/main/webapp/hawtconfig.json
b/artemis-hawtio/artemis-console/src/main/webapp/hawtconfig.json
index 84fe779..940ba41 100644
--- a/artemis-hawtio/artemis-console/src/main/webapp/hawtconfig.json
+++ b/artemis-hawtio/artemis-console/src/main/webapp/hawtconfig.json
@@ -1,10 +1,10 @@
{
"branding": {
"appName": "Artemis Console",
- "appLogoUrl": "/activemq-branding/plugin/img/activemq.png",
- "companyLogoUrl": "/activemq-branding/plugin/img/activemq.png",
- "css": "/activemq-branding/plugin/css/activemq.css",
- "favicon": "/activemq-branding/plugin/img/favicon.png"
+ "appLogoUrl": "",
+ "companyLogoUrl": "",
+ "css": "",
+ "favicon": ""
},
"login": {
"description": "ActiveMQ Artemis Management Console",
@@ -20,7 +20,7 @@
"productInfo": [],
"additionalInfo": "",
"copyright": "",
- "imgSrc": "/activemq-branding/plugin/img/activemq.png"
+ "imgSrc": ""
},
"disabledRoutes": []
}
\ No newline at end of file
diff --git
a/artemis-hawtio/artemis-plugin/src/main/java/org/apache/activemq/hawtio/plugin/PluginContextListener.java
b/artemis-hawtio/artemis-plugin/src/main/java/org/apache/activemq/hawtio/plugin/PluginContextListener.java
index 75fa706..a49b716 100644
---
a/artemis-hawtio/artemis-plugin/src/main/java/org/apache/activemq/hawtio/plugin/PluginContextListener.java
+++
b/artemis-hawtio/artemis-plugin/src/main/java/org/apache/activemq/hawtio/plugin/PluginContextListener.java
@@ -39,7 +39,7 @@ public class PluginContextListener implements
ServletContextListener {
ServletContext context = servletContextEvent.getServletContext();
plugin = new HawtioPlugin();
- plugin.setContext((String)context.getInitParameter("plugin-context"));
+ plugin.setContext(context.getContextPath());
plugin.setName(context.getInitParameter("plugin-name"));
plugin.setScripts(context.getInitParameter("plugin-scripts"));
plugin.setDomain(null);