This is an automated email from the ASF dual-hosted git repository. andytaylor pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-artemis-console.git
commit 638965f06d3864a5dc3224e76ee915bd0a3ec0a2 Author: GChuf <[email protected]> AuthorDate: Sun Nov 2 13:28:25 2025 +0100 ARTEMIS-5737: Fix duplicated jolokia calls on web console's status page --- .../artemis-console-plugin/src/status/Status.tsx | 89 ++++++++++++---------- 1 file changed, 47 insertions(+), 42 deletions(-) diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/status/Status.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/status/Status.tsx index 024c39d..cdbc021 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/status/Status.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/status/Status.tsx @@ -55,57 +55,62 @@ export const Status: React.FunctionComponent = () => { const [showAttributesDialog, setShowAttributesDialog] = useState(false); const [showOperationsDialog, setShowOperationsDialog] = useState(false); - useEffect(() => { - const getBrokerInfo = async () => { - artemisService.getBrokerInfo() - .then((brokerInfo) => { - setBrokerInfo(brokerInfo ?? undefined) - }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) - }); - } - const getAcceptors = async () => { - artemisService.createAcceptors() - .then((acceptors) => { - setAcceptors(acceptors) + const getBrokerInfo = async () => { + artemisService.getBrokerInfo() + .then((brokerInfo) => { + setBrokerInfo(brokerInfo ?? undefined) + }) + .catch((error: string) => { + eventService.notify({ + type: 'warning', + message: error, }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) - }); - } - if (!brokerInfo) { - getBrokerInfo(); - } + }); + } - if (!acceptors) { - getAcceptors(); - } + const getAcceptors = async () => { + artemisService.createAcceptors() + .then((acceptors) => { + setAcceptors(acceptors) + }) + .catch((error: string) => { + eventService.notify({ + type: 'warning', + message: error, + }) + }); + } - if (!clusterConnections) { - artemisService.createClusterConnections() - .then((clusterConnections) => { - setClusterConnections(clusterConnections) + const getClusterConnections = async () => { + artemisService.createClusterConnections() + .then((clusterConnections) => { + setClusterConnections(clusterConnections) + }) + .catch((error: string) => { + eventService.notify({ + type: 'warning', + message: error, }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) - }); - } + }); + } + + useEffect(() => { + // run only once at the beginning + getBrokerInfo(); + + getAcceptors(); + + getClusterConnections(); const timer = setInterval(getBrokerInfo, 5000) return () => clearInterval(timer) - }, [brokerInfo, acceptors, clusterConnections]) + }, []) + + useEffect(() => { + // update frontend when brokerInfo, acceptors, or clusterConnections change + }, [brokerInfo, acceptors, clusterConnections]); const [isBrokerInfoOpen, setIsBrokerInfoOpen] = useState<boolean>(false); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
