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 f7a88e6357ec8defab2f81875f3bf117a2787770 Author: GChuf <[email protected]> AuthorDate: Fri May 30 23:18:17 2025 +0200 ARTEMIS-5424 - Allow listing all items in tables --- .../src/ArtemisPreferences.tsx | 1 + .../src/table/ArtemisTable.tsx | 27 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisPreferences.tsx b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisPreferences.tsx index cbf80e4..9743599 100644 --- a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisPreferences.tsx +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/src/ArtemisPreferences.tsx @@ -197,6 +197,7 @@ const ArtemisPreferencesForm: React.FunctionComponent = () => { <SelectOption label={"20"} value={"20"}>{"20"}</SelectOption> <SelectOption label={"50"} value={"50"}>{"50"}</SelectOption> <SelectOption label={"100"} value={"100"}>{"100"}</SelectOption> + <SelectOption label={"All"} value={"-1"}>{"-1"}</SelectOption> </SelectList> </Select> </FlexItem> 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 616a21e..050476c 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 @@ -118,7 +118,10 @@ const operationOptions = [ const [isSortDropdownOpen, setIsSortDropdownOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false); const [page, setPage] = useState(1); + const [isCompact, setIsCompact] = useState(false); const [perPage, setPerPage] = useState(10); + const pageSize = artemisPreferencesService.loadTablePageSize(broker.storageColumnLocation); + const initialFilter = () => { if (broker.storageColumnLocation && sessionStorage.getItem(broker.storageColumnLocation + '.filter')) { return JSON.parse(sessionStorage.getItem(broker.storageColumnLocation + '.filter') as string); @@ -141,6 +144,9 @@ const operationOptions = [ useEffect(() => { if (!columnsLoaded && broker.storageColumnLocation) { const updatedColumns: Column[] = artemisPreferencesService.loadColumnPreferences(broker.storageColumnLocation, broker.allColumns); + if (pageSize == -1) { + setIsCompact(true); + } setColumns(updatedColumns); setColumnsLoaded(true); } @@ -210,14 +216,28 @@ const operationOptions = [ if(broker.storageColumnLocation) { artemisPreferencesService.saveTablePageSize(broker.storageColumnLocation, newPerPage) } + if (newPerPage === -1) { + setIsCompact(true); + setPerPage(resultsSize); + } else { + setIsCompact(false); + setPerPage(newPerPage); + } setPage(1); - setPerPage(newPerPage); }; const getKeyByValue = (producer: never, columnName: string) => { return producer[columnName]; } + const pageSizeOptions = [ + { title: '10 per page', value: 10 }, + { title: '20 per page', value: 20 }, + { title: '50 per page', value: 50 }, + { title: '100 per page', value: 100 }, + { title: 'All items', value: -1 }, + ]; + const renderPagination = (variant: PaginationVariant | undefined) => ( <Pagination itemCount={resultsSize} @@ -225,9 +245,12 @@ const operationOptions = [ perPage={perPage} onSetPage={handleSetPage} onPerPageSelect={handlePerPageSelect} + isCompact={isCompact} + perPageOptions={pageSizeOptions} variant={variant} titles={{ - paginationAriaLabel: `${variant} pagination` + paginationAriaLabel: `${variant} pagination`, + perPageSuffix: '' }} /> ); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
