This is an automated email from the ASF dual-hosted git repository.

tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis-console.git


The following commit(s) were added to refs/heads/main by this push:
     new 6ff4537  ARTEMIS-5416 - Add Broker name to mast
6ff4537 is described below

commit 6ff4537d154fba536786e1880c3887991c71966a
Author: Andy Taylor <[email protected]>
AuthorDate: Thu May 22 09:19:20 2025 +0100

    ARTEMIS-5416 - Add Broker name to mast
    
    also remove from main page to free up space
---
 .../artemis-extension/app/public/css/activemq.css  |  1 +
 .../artemis-console-plugin/src/Artemis.tsx         | 33 +---------------
 .../artemis-console-plugin/src/ArtemisHeader.tsx   | 44 ++++++++++++++++++++++
 .../artemis-console-plugin/src/ArtemisJMX.tsx      | 37 +-----------------
 .../packages/artemis-console-plugin/src/globals.ts |  1 +
 .../packages/artemis-console-plugin/src/index.ts   | 12 +++++-
 6 files changed, 59 insertions(+), 69 deletions(-)

diff --git 
a/artemis-console-extension/artemis-extension/app/public/css/activemq.css 
b/artemis-console-extension/artemis-extension/app/public/css/activemq.css
index 380d060..b6a48e5 100644
--- a/artemis-console-extension/artemis-extension/app/public/css/activemq.css
+++ b/artemis-console-extension/artemis-extension/app/public/css/activemq.css
@@ -311,6 +311,7 @@ background-color: var(--artemis-global--primary-color--300);
   --artemis-diag-internal-queue-color: #fff;
   --artemis-diag-internal-queue-border:#50621d;
   --artemis-diag-internal-queue-label-text:#000;
+  --artemis-header-text-color: var(--artemis-global--primary-color--100);
   --pf-v5-c-button--m-primary--BackgroundColor: 
var(--artemis-global--primary-color--200);
   --pf-v5-c-button--m-primary--BackgroundColor-hover: 
var(--artemis-global--primary-color--100);
   --pf-v5-global--active-color--100: var(--artemis-global--primary-color--200);
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/Artemis.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/Artemis.tsx
index 2ca5bb1..b38a05b 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/Artemis.tsx
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/Artemis.tsx
@@ -16,9 +16,7 @@
  */
 import React, { useEffect, useState } from 'react'
 import { ArtemisTabs } from './views/ArtemisTabView';
-import { PageSection, TextContent, Text, PageSectionVariants, Page } from 
'@patternfly/react-core';
-import { Grid } from '@patternfly/react-core';
-import { GridItem } from '@patternfly/react-core';
+import { PageSection, Page } from '@patternfly/react-core';
 import { artemisService } from './artemis-service';
 import { eventService } from '@hawtio/react';
 
@@ -26,36 +24,9 @@ import { eventService } from '@hawtio/react';
 
 export const Artemis: React.FunctionComponent = () => {
 
-  const [brokerName, setBrokerName] = useState("");
-
-  useEffect(() => {
-    const getBrokerInfo = async () => {
-        artemisService.getBrokerInfo()
-            .then((brokerInfo) => {
-                setBrokerName(brokerInfo.name)
-            })
-            .catch((error: string) => {
-                eventService.notify({
-                    type: 'warning',
-                    message: error,
-                })
-            });
-    }
-    getBrokerInfo();
-  }, [brokerName])
-
   return ( 
   <Page>
-    <PageSection variant={PageSectionVariants.light}>
-      <Grid >
-        <GridItem span={2}>
-          <TextContent>
-            <Text component="h1">Broker: {brokerName}</Text>
-          </TextContent>
-        </GridItem>
-      </Grid>
-    </PageSection>
-    <PageSection isFilled>
+    <PageSection padding={{default: 'noPadding'}}>
       <ArtemisTabs/>
     </PageSection>
   </Page>
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisHeader.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisHeader.tsx
new file mode 100644
index 0000000..aeff763
--- /dev/null
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisHeader.tsx
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+import { eventService } from '@hawtio/react';
+import {  Text } from '@patternfly/react-core';
+import { useEffect, useState } from 'react';
+import { artemisService } from './artemis-service';
+
+
+export const ArtemisHeader: React.FunctionComponent = () => {
+
+    const [ brokerHeader, setBrokerHeader] = useState('')
+
+     useEffect(() => {
+
+        artemisService.getBrokerInfo()
+        .then((brokerInfo) => {
+           setBrokerHeader(brokerInfo.name);
+        })
+        .catch((error: string) => {
+            eventService.notify({
+                type: 'warning',
+                message: error,
+            })
+        });
+    })
+
+    return (
+        <><Text>{'Broker ('}</Text><Text style={{ color: 
'var(--pf-v5-global--active-color--200)' }} 
>{brokerHeader}</Text><Text>{')'}</Text></>
+    );
+}
\ No newline at end of file
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisJMX.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisJMX.tsx
index deb59ba..2f6e8b5 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisJMX.tsx
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisJMX.tsx
@@ -14,57 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import React, { useEffect, useState } from 'react'
 import { CubesIcon } from '@patternfly/react-icons'
 import Split from 'react-split'
 import { ArtemisContext, useArtemisTree } from './context';
 import { ArtemisTreeView } from './ArtemisTreeView';
 import { PageSection, TextContent, Text, PageSectionVariants, EmptyState, 
EmptyStateIcon, EmptyStateVariant, Title } from '@patternfly/react-core';
-import { Grid } from '@patternfly/react-core';
-import { GridItem } from '@patternfly/react-core';
 import { ArtemisJMXTabs } from './views/ArtemisJMXTabView';
 import './artemisJMX.css'
-import { eventService } from '@hawtio/react';
-import { artemisService } from './artemis-service';
-
 
 
 export const ArtemisJMX: React.FunctionComponent = () => {
 
   const { tree, selectedNode, brokerNode, setSelectedNode, findAndSelectNode } 
= useArtemisTree();
-  const [brokerName, setBrokerName] = useState("");
-
-  useEffect(() => {
-    const getBrokerInfo = async () => {
-        artemisService.getBrokerInfo()
-            .then((brokerInfo) => {
-                setBrokerName(brokerInfo.name)
-            })
-            .catch((error: string) => {
-                eventService.notify({
-                    type: 'warning',
-                    message: error,
-                })
-            });
-    }
-    getBrokerInfo();
-  }, [brokerName])
 
   return ( 
-    <React.Fragment>
-      <PageSection variant={PageSectionVariants.light}>
-        <Grid >
-          <GridItem span={2}>
-          <TextContent>
-            <Text component="h1">Broker: {brokerName}</Text>
-            </TextContent>
-          </GridItem>
-
-      </Grid>
-    </PageSection>
       <ArtemisContext.Provider value={{ tree, selectedNode,brokerNode, 
setSelectedNode, findAndSelectNode }}>
     
-        <Split className='artemis-split' sizes={[25, 75]} minSize={200} 
gutterSize={5}>
+        <Split className='artemis-split' sizes={[30, 70]} minSize={200} 
gutterSize={5}>
           <div>
             <ArtemisTreeView />
           </div>
@@ -88,7 +54,6 @@ export const ArtemisJMX: React.FunctionComponent = () => {
           </div>
         </Split>
       </ArtemisContext.Provider>
-    </React.Fragment>
   )
 }
 
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/globals.ts
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/globals.ts
index 1f9af7f..cf4e856 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/globals.ts
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/globals.ts
@@ -25,6 +25,7 @@ export const artemisNetworkPluginPath = '/artemis-network'
 export const artemisJMXPluginName = 'artemisJMX'
 export const artemisJMXPluginTitle = 'Artemis JMX'
 export const artemisJMXPluginPath = '/treeartemisJMX'
+export const artemisHeaderPluginName = 'artemisHeader'
 
 export const domainNodeType = 'Camel Domain'
 export const contextsType = 'contexts'
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/index.ts
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/index.ts
index 0a4f08b..3bea8eb 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/index.ts
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/index.ts
@@ -18,14 +18,14 @@ import { HawtioPlugin, hawtio, configManager as 
hawtioConfigMgr, helpRegistry, w
 import { Artemis } from './Artemis'
 import { ArtemisJMX } from './ArtemisJMX'
 import { ArtemisPreferences } from './ArtemisPreferences'
-import { log, artemisPluginName, artemisPluginTitle, artemisPluginPath, 
artemisJMXPluginName, artemisJMXPluginPath, artemisJMXPluginTitle } from 
'./globals'
+import { log, artemisPluginName, artemisPluginTitle, artemisPluginPath, 
artemisJMXPluginName, artemisJMXPluginPath, artemisJMXPluginTitle, 
artemisHeaderPluginName } from './globals'
 import help from './help.md'
 import { configManager } from './config-manager'
+import { ArtemisHeader } from './ArtemisHeader';
 
 export const artemis: HawtioPlugin = () => {
 
 
-
   log.info('Loading', artemisPluginName);
 
   hawtio.addPlugin({
@@ -46,6 +46,14 @@ export const artemis: HawtioPlugin = () => {
     isActive:  async () => workspace.treeContainsDomainAndProperties((await 
configManager.getArtemisconfig()).jmx.domain),
   })
 
+  hawtio.addPlugin({
+    id: artemisHeaderPluginName,
+    title: artemisHeaderPluginName,
+    headerItems: [{ component: ArtemisHeader, universal: true }],
+    order: 200,
+    isActive: async () => workspace.treeContainsDomainAndProperties((await 
configManager.getArtemisconfig()).jmx.domain),
+  })
+
   helpRegistry.add(artemisPluginName, artemisPluginTitle, help, 1)
   preferencesRegistry.add(artemisPluginName, artemisPluginTitle, 
ArtemisPreferences, 1)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to