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 7aeceb2..963cde5 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 = () => { {"20"} {"50"} {"100"} + {"-1"} 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 2e9e622..45135e1 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 @@ -121,6 +121,7 @@ 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 initialFilter = () => { if (broker.storageColumnLocation && sessionStorage.getItem(broker.storageColumnLocation + '.filter')) { @@ -154,7 +155,11 @@ const operationOptions = [ setColumnsLoaded(true); } if(broker.storageColumnLocation) { - setPerPage(artemisPreferencesService.loadTablePageSize(broker.storageColumnLocation)); + const pageSize = artemisPreferencesService.loadTablePageSize(broker.storageColumnLocation); + setPerPage(pageSize); + if (pageSize == -1) { + setIsCompact(true); + } } listData(); @@ -243,8 +248,14 @@ 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) => { @@ -264,6 +275,14 @@ const operationOptions = [ } } + 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) => ( );