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


The following commit(s) were added to refs/heads/main by this push:
     new e1f8198  ARTEMIS-5629 - reload tables on create/delete of rows
e1f8198 is described below

commit e1f81984b8d283e10b0132856beadecd8033279a
Author: Andy Taylor <[email protected]>
AuthorDate: Wed Oct 1 10:23:54 2025 +0100

    ARTEMIS-5629 - reload tables on create/delete of rows
---
 .../src/addresses/AddressesTable.tsx               |   9 +-
 .../src/addresses/CreateAddress.tsx                | 144 ++++++++++++---------
 .../src/table/ArtemisTable.tsx                     |   4 +-
 3 files changed, 94 insertions(+), 63 deletions(-)

diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/AddressesTable.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/AddressesTable.tsx
index ca7ad83..b0c3025 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/AddressesTable.tsx
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/AddressesTable.tsx
@@ -81,6 +81,7 @@ export const AddressesTable: 
React.FunctionComponent<Navigate> = (navigate) => {
   const [showCreateAddressDialog, setShowCreateAddressDialog] = 
useState(false);
   const [showSendDialog, setShowSendDialog] = useState(false);
   const [address, setAddress] = useState("");
+  const [loadData, setLoadData] = useState(0);
   const canCreateQueue = artemisService.canCreateQueue(brokerNode);
   const canDeleteAddress = artemisService.canDeleteAddress(brokerNode);
   const canCreateAddress = artemisService.canCreateAddress(brokerNode);
@@ -163,12 +164,16 @@ export const AddressesTable: 
React.FunctionComponent<Navigate> = (navigate) => {
     return actions;
   };
 
+  const reload = () => {
+    setLoadData(loadData + 1);
+  }
 
   const handleDeleteAddress = () => {
     artemisService.deleteAddress(address)
       .then(() => {
         setShowDeleteDialog(false);
         workspace.refreshTree();
+        reload();
         eventService.notify({
           type: 'success',
           message: "Address Successfully Deleted",
@@ -185,7 +190,7 @@ export const AddressesTable: 
React.FunctionComponent<Navigate> = (navigate) => {
 
   return (
     <ArtemisContext.Provider value={{ tree, selectedNode, brokerNode, 
setSelectedNode, findAndSelectNode }}>
-      <ArtemisTable getRowActions={getRowActions} allColumns={allColumns} 
getData={listAddresses} storageColumnLocation={columnStorage.addresses}  
toolbarActions={[createAction]} navigate={navigate.search} 
filter={navigate.filter}/>
+      <ArtemisTable getRowActions={getRowActions} allColumns={allColumns} 
getData={listAddresses} loadData={loadData} 
storageColumnLocation={columnStorage.addresses}  
toolbarActions={[createAction]} navigate={navigate.search} 
filter={navigate.filter}/>
       <Modal
         aria-label='create-queue-modal'
         variant={ModalVariant.medium}
@@ -261,7 +266,7 @@ export const AddressesTable: 
React.FunctionComponent<Navigate> = (navigate) => {
             Close
           </Button>
         ]}>
-        <CreateAddress/>
+        <CreateAddress reload={reload}/>
       </Modal>
       <Modal
         aria-label='send-modal'
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/CreateAddress.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/CreateAddress.tsx
index 6b12596..ec4941c 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/CreateAddress.tsx
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/CreateAddress.tsx
@@ -14,71 +14,95 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { ActionGroup, Button, Form, FormGroup, Text, Popover, Radio, 
TextContent, TextInput, Title } from '@patternfly/react-core';
-import React, { useState } from 'react'
-import { artemisService } from '../artemis-service';
-import { eventService } from '@hawtio/react';
-import { OutlinedQuestionCircleIcon } from 
'@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
+import {
+    ActionGroup,
+    Button,
+    Form,
+    FormGroup,
+    Text,
+    Popover,
+    Radio,
+    TextContent,
+    TextInput,
+    Title
+} from '@patternfly/react-core';
+import React, {useState} from 'react'
+import {artemisService} from '../artemis-service';
+import {eventService} from '@hawtio/react';
+import {OutlinedQuestionCircleIcon} from 
'@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
 
-export const CreateAddress: React.FunctionComponent = () => {
-  const [addressName, setAddressName] = useState('');
-  const [routingType, setRoutingType] = useState('');
+interface CreateAddressProps {
+    reload: Function
+}
+
+export const CreateAddress: React.FunctionComponent<CreateAddressProps> = 
(createAddressProps) => {
+    const [addressName, setAddressName] = useState('');
+    const [routingType, setRoutingType] = useState('');
 
-  const handleQueueNameChange = (_event: React.FormEvent<HTMLInputElement>, 
name: string) => {
-    setAddressName(name);
-  };
+    const handleQueueNameChange = (_event: React.FormEvent<HTMLInputElement>, 
name: string) => {
+        setAddressName(name);
+    };
 
-  const handleQueueRoutingTypeChange = (name: string) => {
-    setRoutingType(name);
-  };
+    const handleQueueRoutingTypeChange = (name: string) => {
+        setRoutingType(name);
+    };
 
-  const handleCreateAddress = () => {
-    artemisService.createAddress(addressName, routingType)
-      .then(() => {
-        eventService.notify({
-          type: 'success',
-          message: "Address Succcesfully Created",
-        })
-      })
-      .catch((error: string) => {
-        eventService.notify({
-          type: 'warning',
-          message: error,
-        })
-      })
-  };
+    const handleCreateAddress = () => {
+        artemisService.createAddress(addressName, routingType)
+            .then(() => {
+                if (createAddressProps !== undefined) {
+                    createAddressProps.reload();
+                }
+                eventService.notify({
+                    type: 'success',
+                    message: "Address Succcesfully Created",
+                })
+            })
+            .catch((error: string) => {
+                eventService.notify({
+                    type: 'warning',
+                    message: error,
+                })
+            })
+    };
 
-  const Hint = () => (
-    <TextContent>
-        <Text component='p'>
-        Use this page to create a new address on the broker. If you want the 
address to support JMS-like queues, that is point-to-point messaging, choose 
Anycast. If you want the  address to support JMS-like topic subscriptions, that 
is publish-subscribe messaging, choose Multicast.
-        </Text>
-    </TextContent>
-)
+    const Hint = () => (
+        <TextContent>
+            <Text component='p'>
+                Use this page to create a new address on the broker. If you 
want the address to support JMS-like queues,
+                that is point-to-point messaging, choose Anycast. If you want 
the address to support JMS-like topic
+                subscriptions, that is publish-subscribe messaging, choose 
Multicast.
+            </Text>
+        </TextContent>
+    )
 
-  return (
-    <>
-    <Title headingLevel="h2">Create Address{' '}<Popover 
bodyContent={Hint}><OutlinedQuestionCircleIcon /></Popover></Title>
-      <br/>
-      <Form>
-        <FormGroup label="Address Name">
-          <TextInput
-            isRequired
-            type="text"
-            id="address-name"
-            name="address-name"
-            value={addressName}
-            onChange={handleQueueNameChange} />
-        </FormGroup>
-        <FormGroup role="radiogroup" isInline fieldId="routing-type" 
label="Routing Type">
-          <Radio name="basic-inline-radio" label="Anycast" id="ANYCAST" 
onChange={() => handleQueueRoutingTypeChange("ANYCAST")} />
-          <Radio name="basic-inline-radio" label="Multicast" id="MULTICAST" 
onChange={() => handleQueueRoutingTypeChange("MULTICAST")} />
-        </FormGroup>
+    return (
+        <>
+            <Title headingLevel="h2">Create Address{' '}<Popover
+                
bodyContent={Hint}><OutlinedQuestionCircleIcon/></Popover></Title>
+            <br/>
+            <Form>
+                <FormGroup label="Address Name">
+                    <TextInput
+                        isRequired
+                        type="text"
+                        id="address-name"
+                        name="address-name"
+                        value={addressName}
+                        onChange={handleQueueNameChange}/>
+                </FormGroup>
+                <FormGroup role="radiogroup" isInline fieldId="routing-type" 
label="Routing Type">
+                    <Radio name="basic-inline-radio" label="Anycast" 
id="ANYCAST"
+                           onChange={() => 
handleQueueRoutingTypeChange("ANYCAST")}/>
+                    <Radio name="basic-inline-radio" label="Multicast" 
id="MULTICAST"
+                           onChange={() => 
handleQueueRoutingTypeChange("MULTICAST")}/>
+                </FormGroup>
 
-        <ActionGroup>
-          <Button variant="primary" onClick={() => handleCreateAddress()} 
isDisabled={addressName.length === 0 || routingType.length === 0}>Create 
Address</Button>
-        </ActionGroup>
-      </Form>
-      </>
-  )
+                <ActionGroup>
+                    <Button variant="primary" onClick={() => 
handleCreateAddress()}
+                            isDisabled={addressName.length === 0 || 
routingType.length === 0}>Create Address</Button>
+                </ActionGroup>
+            </Form>
+        </>
+    )
 }
diff --git 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
index 48757ab..08e8433 100644
--- 
a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
+++ 
b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/table/ArtemisTable.tsx
@@ -45,6 +45,8 @@ import {
 } from '@patternfly/react-core/deprecated'
 
 import { ArtemisFilters } from './ArtemisFilters';
+import {Simulate} from "react-dom/test-utils";
+import loadedData = Simulate.loadedData;
 
 export type Column = {
   id: string
@@ -167,7 +169,7 @@ const operationOptions = [
 
   useEffect(() => {
     listData();
-  }, [page, perPage, activeSort, filter]);
+  }, [page, perPage, activeSort, filter, broker.loadData]);
 
   const handleModalToggle = () => {
     setIsModalOpen(!isModalOpen);


---------------------------------------------------------------------
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