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-console.git
commit 9ee3a3347530371e01b11c56f766d80e32ce6be1 Author: Grzegorz Grzybek <[email protected]> AuthorDate: Tue Nov 18 11:45:16 2025 +0100 ARTEMIS-5760: Handle _all_ places where jolokiaService may throw RBAC-related exception --- .../artemis-console-plugin/src/ArtemisHeader.tsx | 9 +++------ .../src/addresses/AddressesTable.tsx | 14 +++++++------- .../src/addresses/CreateAddress.tsx | 11 ++++------- .../src/addresses/DeleteAddress.tsx | 12 +++++------- .../artemis-console-plugin/src/artemis-service.ts | 22 +++++++++++++++++----- .../src/connections/ConnectionsTable.tsx | 14 +++++++------- .../src/consumers/ConsumerTable.tsx | 14 +++++++------- .../src/messages/MessagesTable.tsx | 9 +++------ .../src/messages/QueueSelect.tsx | 6 +++++- .../src/messages/SendMessage.tsx | 20 +++++++------------- .../src/producers/ProducerTable.tsx | 6 +++++- .../src/queues/CreateQueue.tsx | 11 ++++------- .../src/queues/DeleteQueue.tsx | 16 +++++----------- .../src/queues/QueuesTable.tsx | 21 +++++++++------------ .../src/sessions/SessionsTable.tsx | 14 +++++++------- 15 files changed, 95 insertions(+), 104 deletions(-) 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 index 37cc9b0..b64df95 100644 --- 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 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { eventService } from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import { Text } from '@patternfly/react-core'; import { useEffect, useState } from 'react'; import { artemisService } from './artemis-service'; @@ -29,11 +29,8 @@ export const ArtemisHeader: React.FunctionComponent = () => { .then((brokerName) => { setBrokerHeader(brokerName ? brokerName : ''); }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + .catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }); },[]) 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 f2af960..726092b 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 @@ -22,7 +22,7 @@ import { IAction } from '@patternfly/react-table'; import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; import { Button, Icon, Modal, ModalVariant, TextContent, Text } from '@patternfly/react-core'; import { CreateQueue } from '../queues/CreateQueue'; -import { Attributes, eventService, Operations, workspace } from '@hawtio/react'; +import { Attributes, eventService, jolokiaService, Operations, workspace } from '@hawtio/react'; import { ArtemisContext } from '../context'; import { CreateAddress } from './CreateAddress'; import { SendMessage } from '../messages/SendMessage'; @@ -65,7 +65,10 @@ export const AddressesTable: React.FunctionComponent<Navigate> = (navigate) => { ]; const listAddresses = async (page: number, perPage: number, activeSort: ActiveSort, filter: Filter): Promise<any> => { - const response = await artemisService.getAddresses(page, perPage, activeSort, filter); + const response = await artemisService.getAddresses(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: 'warning', message: jolokiaService.errorMessage(error)}) + return JSON.stringify({ data: [], count: 0 }) + }) const data = JSON.parse(response); return data; } @@ -179,12 +182,9 @@ export const AddressesTable: React.FunctionComponent<Navigate> = (navigate) => { message: "Address Successfully Deleted", }) }) - .catch((error: string) => { + .catch((error) => { setShowDeleteDialog(false); - eventService.notify({ - type: 'warning', - message: error, - }) + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) }; 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 ec4941c..91694a1 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 @@ -28,7 +28,7 @@ import { } from '@patternfly/react-core'; import React, {useState} from 'react' import {artemisService} from '../artemis-service'; -import {eventService} from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import {OutlinedQuestionCircleIcon} from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon'; interface CreateAddressProps { @@ -55,14 +55,11 @@ export const CreateAddress: React.FunctionComponent<CreateAddressProps> = (creat } eventService.notify({ type: 'success', - message: "Address Succcesfully Created", + message: "Address Successfully Created", }) }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + .catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/DeleteAddress.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/DeleteAddress.tsx index 942bbbe..b556e54 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/DeleteAddress.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/addresses/DeleteAddress.tsx @@ -17,7 +17,7 @@ import { ActionGroup, Text, Button, Form, Icon, Modal, ModalVariant, TextContent, Title, Popover } from '@patternfly/react-core'; import React, { useState } from 'react' import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; -import { eventService, workspace } from '@hawtio/react'; +import { eventService, jolokiaService, workspace } from '@hawtio/react'; import { artemisService } from '../artemis-service'; import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon'; @@ -33,17 +33,15 @@ export const DeleteAddress: React.FunctionComponent<DeleteAddressProps> = (props .then(() => { setShowDeleteModal(false); - workspace.refreshTree(); eventService.notify({ + workspace.refreshTree(); + eventService.notify({ type: 'success', message: "Address Successfully Deleted", }) }) - .catch((error: string) => { + .catch((error) => { setShowDeleteModal(false); - eventService.notify({ - type: 'warning', - message: error, - }) + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-service.ts b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-service.ts index aee3de3..084f2dd 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-service.ts +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/artemis-service.ts @@ -425,7 +425,7 @@ class ArtemisService { } async createQueue(queueConfiguration: string) { - return await jolokiaService.execute(await this.getBrokerObjectName(), CREATE_QUEUE_SIG, [queueConfiguration, false]).then().catch() as string; + return await jolokiaService.execute(await this.getBrokerObjectName(), CREATE_QUEUE_SIG, [queueConfiguration, false]).then() as string; } async createAddress(address: string, routingType: string) { @@ -435,11 +435,20 @@ class ArtemisService { async getMessages(mBean: string, page: number, perPage: number, filter: string) { let count: number; if (filter && filter.length > 0) { - count = await jolokiaService.execute(mBean, COUNT_MESSAGES_SIG2, [filter]) as number; + count = await jolokiaService.execute(mBean, COUNT_MESSAGES_SIG2, [filter]).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return 0 + }) as number; } else { - count = await jolokiaService.execute(mBean, COUNT_MESSAGES_SIG) as number; + count = await jolokiaService.execute(mBean, COUNT_MESSAGES_SIG).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return 0 + }) as number; } - const messages = await jolokiaService.execute(mBean, BROWSE_SIG, [page, perPage, filter]) as string; + const messages = await jolokiaService.execute(mBean, BROWSE_SIG, [page, perPage, filter]).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return [] + }) as string; return { data: messages, count: count @@ -503,7 +512,10 @@ class ArtemisService { async getAllAddresses(addressFilter: string): Promise<string[]> { return new Promise<string[]>(async (resolve, reject) => { - const addressesString = await jolokiaService.execute(await this.getBrokerObjectName(), LIST_ALL_ADDRESSES_SIG, [',']) as string; + const addressesString = await jolokiaService.execute(await this.getBrokerObjectName(), LIST_ALL_ADDRESSES_SIG, [',']).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return "" + }) as string; if (addressesString) { const addressArray = addressesString.split(',') if (addressFilter && addressFilter.length > 0) { diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/connections/ConnectionsTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/connections/ConnectionsTable.tsx index dc38872..ec87567 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/connections/ConnectionsTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/connections/ConnectionsTable.tsx @@ -20,7 +20,7 @@ import { ActiveSort, ArtemisTable, Column, Filter } from '../table/ArtemisTable' import { artemisService } from '../artemis-service'; import { Modal, ModalVariant, Button } from '@patternfly/react-core'; import { IAction } from '@patternfly/react-table'; -import { eventService } from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import { columnStorage } from '../artemis-preferences-service'; export const ConnectionsTable: React.FunctionComponent<Navigate> = (navigate) => { @@ -49,7 +49,10 @@ export const ConnectionsTable: React.FunctionComponent<Navigate> = (navigate) => const [loadData, setLoadData] = useState(0); const listConnections = async (page: number, perPage: number, activeSort: ActiveSort, filter: Filter): Promise<any> => { - const response = await artemisService.getConnections(page, perPage, activeSort, filter); + const response = await artemisService.getConnections(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return JSON.stringify({ data: [], count: 0 }) + }) const data = JSON.parse(response); return data; } @@ -66,12 +69,9 @@ export const ConnectionsTable: React.FunctionComponent<Navigate> = (navigate) => duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowConnectionCloseDialog(false); - eventService.notify({ - type: 'danger', - message: 'Connection Not Closed: ' + error, - }) + eventService.notify({type: 'danger', message: 'Connection Not Closed: ' + jolokiaService.errorMessage(error) }) }); }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/consumers/ConsumerTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/consumers/ConsumerTable.tsx index b43beab..3cb47eb 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/consumers/ConsumerTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/consumers/ConsumerTable.tsx @@ -18,7 +18,7 @@ import React, { useState } from 'react' import { Navigate } from '../views/ArtemisTabView.js'; import { ActiveSort, ArtemisTable, Column, Filter } from '../table/ArtemisTable'; import { artemisService } from '../artemis-service'; -import { eventService } from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import { Modal, ModalVariant, Button } from '@patternfly/react-core'; import { IAction } from '@patternfly/react-table'; import { columnStorage } from '../artemis-preferences-service'; @@ -75,7 +75,10 @@ export const ConsumerTable: React.FunctionComponent<Navigate> = navigate => { ]; const listConsumers = async ( page: number, perPage: number, activeSort: ActiveSort, filter: Filter):Promise<any> => { - const response = await artemisService.getConsumers(page, perPage, activeSort, filter); + const response = await artemisService.getConsumers(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: 'warning', message: jolokiaService.errorMessage(error)}) + return JSON.stringify({data: [], count: 0}) + }) const data = JSON.parse(response); return data; } @@ -96,12 +99,9 @@ export const ConsumerTable: React.FunctionComponent<Navigate> = navigate => { duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowConsumerCloseDialog(false); - eventService.notify({ - type: 'danger', - message: 'Consumer Not Closed: ' + error, - }) + eventService.notify({type: 'danger', message: 'Consumer Not Closed: ' + jolokiaService.errorMessage(error) }) }); }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/MessagesTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/MessagesTable.tsx index 6c25175..caf438b 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/MessagesTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/MessagesTable.tsx @@ -22,7 +22,7 @@ import { Thead, Tr, Th, Tbody, Td, ActionsColumn, IAction, Table, InnerScrollCon import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; import { createQueueObjectName } from '../util/jmx'; import { Link } from 'react-router-dom'; -import { eventService } from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import { QueueSelectInput } from './QueueSelect'; import { SendMessage } from './SendMessage'; import { Message } from './MessageView'; @@ -86,11 +86,8 @@ export const MessagesTable: React.FunctionComponent<MessageProps> = props => { listMessages().then((data) => { setRows(data.data); setresultsSize(data.count); - }).catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + }).catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) } const listMessages = async (): Promise<any> => { diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/QueueSelect.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/QueueSelect.tsx index d6a10e9..c8edc12 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/QueueSelect.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/QueueSelect.tsx @@ -19,6 +19,7 @@ import { Button, MenuToggle, MenuToggleElement, Select, SelectList, SelectOption import { artemisService } from '../artemis-service'; import { ActiveSort, Filter, SortDirection } from '../table/ArtemisTable'; import { TimesIcon } from '@patternfly/react-icons/dist/esm/icons/times-icon' +import { eventService, jolokiaService } from '@hawtio/react' export type QueueSelectProps = { selectQueue: Function @@ -43,7 +44,10 @@ export const QueueSelectInput: React.FunctionComponent<QueueSelectProps> = (queu id: 'name', order: SortDirection.ASCENDING } - const data: any = await artemisService.getQueues(1, 10, activeSort, filter); + const data: any = await artemisService.getQueues(1, 10, activeSort, filter).catch(error => { + eventService.notify({ type: "warning", message: jolokiaService.errorMessage(error) }) + return JSON.stringify({ data: [], count: 0 }) + }) const queues = JSON.parse(data).data if (queues.length > 0) { setQueues(queues); diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/SendMessage.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/SendMessage.tsx index e2322da..d72b715 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/SendMessage.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/messages/SendMessage.tsx @@ -41,7 +41,7 @@ import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/ico import { InfoCircleIcon } from '@patternfly/react-icons/dist/esm/icons/info-circle-icon' import { TrashIcon } from '@patternfly/react-icons/dist/esm/icons/trash-icon' import { CodeEditor, Language } from '@patternfly/react-code-editor' -import { eventService } from '@hawtio/react' +import { eventService, jolokiaService } from '@hawtio/react' import { artemisService } from '../artemis-service' import { Message } from './MessageView' @@ -260,28 +260,22 @@ export const SendMessage: React.FunctionComponent<SendMessageProps> = (props: Se .then(() => { eventService.notify({ type: 'success', - message: "Message Succcesfully Sent", + message: "Message Successfully Sent", }) }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + .catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) } else { artemisService.doSendMessageToQueue(messageBody.current, messageHeaders.current, isDurableChecked, isCreateIDChecked, isUseLogonChecked, username, password, props.routingType.toLowerCase(), props.queue, props.address) .then(() => { eventService.notify({ type: 'success', - message: "Message Succcesfully Sent", + message: "Message Successfully Sent", }) }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + .catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) } } diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/producers/ProducerTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/producers/ProducerTable.tsx index 6ac2c0a..bb3fd15 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/producers/ProducerTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/producers/ProducerTable.tsx @@ -19,6 +19,7 @@ import { Navigate } from '../views/ArtemisTabView.js'; import { ActiveSort, ArtemisTable, Column, Filter } from '../table/ArtemisTable'; import { artemisService } from '../artemis-service'; import { columnStorage } from '../artemis-preferences-service'; +import { eventService, jolokiaService } from '@hawtio/react' export const ProducerTable: React.FunctionComponent<Navigate> = navigate => { const getSessionFilter = (row: any) => { @@ -57,7 +58,10 @@ export const ProducerTable: React.FunctionComponent<Navigate> = navigate => { ]; const listProducers = async ( page: number, perPage: number, activeSort: ActiveSort, filter: Filter):Promise<any> => { - const response = await artemisService.getProducers(page, perPage, activeSort, filter); + const response = await artemisService.getProducers(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: 'warning', message: jolokiaService.errorMessage(error)}) + return JSON.stringify({data: [], count: 0}) + }) const data = JSON.parse(response); return data; } diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/CreateQueue.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/CreateQueue.tsx index dad7ceb..3cb01a9 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/CreateQueue.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/CreateQueue.tsx @@ -20,7 +20,7 @@ import { TrashIcon } from '@patternfly/react-icons/dist/esm/icons/trash-icon' import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon' import { InfoCircleIcon } from '@patternfly/react-icons/dist/esm/icons/info-circle-icon' import { artemisService } from '../artemis-service'; -import { eventService, workspace } from '@hawtio/react'; +import { eventService, jolokiaService, workspace } from '@hawtio/react'; type CreateQueueProps = { address: string @@ -65,14 +65,11 @@ export const CreateQueue: React.FunctionComponent<CreateQueueProps> = (props: Cr workspace.refreshTree(); eventService.notify({ type: 'success', - message: "Queue Succcesfully Created", + message: "Queue Successfully Created", }) }) - .catch((error: string) => { - eventService.notify({ - type: 'warning', - message: error, - }) + .catch((error) => { + eventService.notify({type: 'warning', message: jolokiaService.errorMessage(error) }) }) }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/DeleteQueue.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/DeleteQueue.tsx index f05ca32..5282b9b 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/DeleteQueue.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/DeleteQueue.tsx @@ -16,7 +16,7 @@ */ import { ActionGroup, Button, Form, Modal, ModalVariant, Popover, TextContent, Title, Text } from '@patternfly/react-core'; import React, { useState } from 'react' -import { eventService, workspace } from '@hawtio/react'; +import { eventService, jolokiaService, workspace } from '@hawtio/react'; import { artemisService } from '../artemis-service'; import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon'; @@ -42,12 +42,9 @@ export const DeleteQueue: React.FunctionComponent<DeleteQueueProps> = (props: De duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowDeleteModal(false); - eventService.notify({ - type: 'danger', - message: 'Queue Not Deleted: ' + error, - }) + eventService.notify({type: 'danger', message: 'Queue Not Deleted: ' + jolokiaService.errorMessage(error) }) }); }; @@ -61,12 +58,9 @@ export const DeleteQueue: React.FunctionComponent<DeleteQueueProps> = (props: De duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowPurgeModal(false); - eventService.notify({ - type: 'danger', - message: 'Queue Not Purged: ' + error, - }) + eventService.notify({type: 'warning', message: 'Queue Not Purged: ' + jolokiaService.errorMessage(error) }) }); }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/QueuesTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/QueuesTable.tsx index 0ea8052..d5f2419 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/QueuesTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/queues/QueuesTable.tsx @@ -20,7 +20,7 @@ import { artemisService } from '../artemis-service'; import { IAction } from '@patternfly/react-table'; import { Button, Modal, ModalVariant } from '@patternfly/react-core'; import { SendMessage } from '../messages/SendMessage'; -import { Attributes, eventService, Operations } from '@hawtio/react'; +import { Attributes, eventService, jolokiaService, Operations } from '@hawtio/react'; import { QueueNavigate } from './QueuesView.js'; import { ArtemisContext } from '../context'; import { createQueueObjectName } from '../util/jmx'; @@ -94,7 +94,10 @@ export const QueuesTable: React.FunctionComponent<QueueNavigate> = navigate => { ]; const listQueues = async (page: number, perPage: number, activeSort: ActiveSort, filter: Filter): Promise<any> => { - const response = await artemisService.getQueues(page, perPage, activeSort, filter); + const response = await artemisService.getQueues(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: 'warning', message: jolokiaService.errorMessage(error)}) + return JSON.stringify({ data: [], count: 0 }) + }) const data = JSON.parse(response); return data; } @@ -137,12 +140,9 @@ export const QueuesTable: React.FunctionComponent<QueueNavigate> = navigate => { duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowDeleteDialog(false); - eventService.notify({ - type: 'danger', - message: 'Queue Not Deleted: ' + error, - }) + eventService.notify({type: 'danger', message: 'Queue Not Deleted: ' + jolokiaService.errorMessage(error) }) }); }; @@ -157,12 +157,9 @@ export const QueuesTable: React.FunctionComponent<QueueNavigate> = navigate => { duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowPurgeDialog(false); - eventService.notify({ - type: 'danger', - message: 'Queue Not Purged: ' + error, - }) + eventService.notify({type: 'danger', message: 'Queue Not Purged: ' + jolokiaService.errorMessage(error) }) }); }; diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/sessions/SessionsTable.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/sessions/SessionsTable.tsx index 1943c1e..49497aa 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/sessions/SessionsTable.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/sessions/SessionsTable.tsx @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { eventService } from '@hawtio/react'; +import { eventService, jolokiaService } from '@hawtio/react'; import { Modal, ModalVariant, Button } from '@patternfly/react-core'; import { IAction } from '@patternfly/react-table'; import React, { useState } from 'react' @@ -68,7 +68,10 @@ export const SessionsTable: React.FunctionComponent<Navigate> = navigate => { const [sessionConnection, setSessionConnection] = useState(""); const [loadData, setLoadData] = useState(0); const listSessions = async (page: number, perPage: number, activeSort: ActiveSort, filter: Filter): Promise<any> => { - const response = await artemisService.getSessions(page, perPage, activeSort, filter); + const response = await artemisService.getSessions(page, perPage, activeSort, filter).catch(error => { + eventService.notify({ type: 'warning', message: jolokiaService.errorMessage(error)}) + return JSON.stringify({ data: [], count: 0 }) + }) const data = JSON.parse(response); return data; } @@ -85,12 +88,9 @@ export const SessionsTable: React.FunctionComponent<Navigate> = navigate => { duration: 3000, }) }) - .catch((error: string) => { + .catch((error) => { setShowSessionCloseDialog(false); - eventService.notify({ - type: 'danger', - message: 'Session Not Closed: ' + error, - }) + eventService.notify({type: 'danger', message: 'Session Not Closed: ' + jolokiaService.errorMessage(error) }) }); }; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
