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

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


The following commit(s) were added to refs/heads/main by this push:
     new d7428db  ARTEMIS-5944 - Fix duplicate broker node displayed
d7428db is described below

commit d7428dbfed32b4f69144bdc91fb1222bb91b4805
Author: Grzegorz Grzybek <[email protected]>
AuthorDate: Tue Mar 10 14:40:23 2026 +0100

    ARTEMIS-5944 - Fix duplicate broker node displayed
---
 .../src/artemis-tree-processor.ts                  | 37 ++++++++++++----------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-tree-processor.ts
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-tree-processor.ts
index 5749ae2..0528583 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-tree-processor.ts
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-tree-processor.ts
@@ -89,25 +89,30 @@ function findBrokers(children: MBeanNode[] | undefined): 
MBeanNode[] {
     }
   }
   const brokers: MBeanNode[] = []
+  for (const c of children) {
+    if (oldBrokers.has(c.name) && c.id.endsWith('-folder')) {
+      const oldBrokerNode = oldBrokers.get(c.name)!
+      const newBrokerNode = new MBeanNode(null, `Broker ${c.name}`, true)
+      newBrokerNode.icon = c.icon
+      newBrokerNode.expandedIcon = c.expandedIcon
+      newBrokerNode.children = []
+      // newBrokerNode.metadata = oldBrokerNode.metadata
+      newBrokerNode.objectName = oldBrokerNode.objectName
+      newBrokerNode.mbean = oldBrokerNode.mbean
+      newBrokerNode.propertyList = oldBrokerNode.propertyList
+
+      const children = [...c.children!]
+      children.forEach(c => {
+        newBrokerNode.adopt(c)
+      })
+      brokers.push(newBrokerNode)
+    }
+  }
+  // iterate again to catch the brokers which didn't have any children (were 
not a '-folder')
   for (const c of children) {
     if (oldBrokers.has(c.name)) {
       const oldBrokerNode = oldBrokers.get(c.name)!
-      if (c.id.endsWith('-folder')) {
-        const newBrokerNode = new MBeanNode(null, `Broker ${c.name}`, true)
-        newBrokerNode.icon = c.icon
-        newBrokerNode.expandedIcon = c.expandedIcon
-        newBrokerNode.children = []
-        // newBrokerNode.metadata = oldBrokerNode.metadata
-        newBrokerNode.objectName = oldBrokerNode.objectName
-        newBrokerNode.mbean = oldBrokerNode.mbean
-        newBrokerNode.propertyList = oldBrokerNode.propertyList
-
-        const children = [...c.children!]
-        children.forEach(c => {
-          newBrokerNode.adopt(c)
-        })
-        brokers.push(newBrokerNode)
-      } else {
+      if (!c.id.endsWith('-folder') && !brokers.find(b => b.name === `Broker 
${c.name}`)) {
         // the broker doesn't have children at all, but we still need the node
         const newBrokerNode = new MBeanNode(null, `Broker ${c.name}`, false)
         newBrokerNode.icon = c.icon


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to