You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@artemis.apache.org by an...@apache.org on 2026/04/16 10:00:58 UTC
(artemis-console) 01/02: ARTEMIS-5963 - Fix pagination
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/artemis-console.git
commit 199d3a8c549245d279d8e858166fcfcd3090abfa
Author: gchuf <ga...@gmail.com>
AuthorDate: Sat Apr 11 15:55:41 2026 +0200
ARTEMIS-5963 - Fix pagination
Fixes incorrect page count after navigating away from and back to the page
Fixes per page options (apply last selection from user, saved in local storage)
---
.../src/table/ArtemisTable.tsx | 26 +++++++++++++---------
1 file changed, 16 insertions(+), 10 deletions(-)
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 08e8433..143aa23 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
@@ -111,6 +111,16 @@ const operationOptions = [
};
}
+ const initialPerPage = () => {
+ if (broker.storageColumnLocation) {
+ const savedPerPage = artemisPreferencesService.loadTablePageSize(
+ broker.storageColumnLocation
+ );
+ return savedPerPage ?? 10;
+ }
+ return 10;
+ }
+
const [rows, setRows] = useState([])
const [resultsSize, setresultsSize] = useState(0)
const [columnsLoaded, setColumnsLoaded] = useState(false);
@@ -120,11 +130,8 @@ const operationOptions = [
const [isSortDropdownOpen, setIsSortDropdownOpen] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const [page, setPage] = useState(1);
+ const [perPage, setPerPage] = useState(initialPerPage);
const [isCompact, setIsCompact] = useState(false);
- const [perPage, setPerPage] = useState(10);
- const [perPageOption, setPerPageOption] = useState(1);
- const pageSize = artemisPreferencesService.loadTablePageSize(broker.storageColumnLocation);
-
const rootElement = document.getElementById('root') as HTMLElement;
const popperProps = {
position: 'right' as const,
@@ -159,7 +166,7 @@ const operationOptions = [
useEffect(() => {
if (!columnsLoaded && broker.storageColumnLocation) {
const updatedColumns: Column[] = artemisPreferencesService.loadColumnPreferences(broker.storageColumnLocation, broker.allColumns);
- if (pageSize == -1) {
+ if (perPage == -1) {
setIsCompact(true);
}
setColumns(updatedColumns);
@@ -228,10 +235,6 @@ const operationOptions = [
};
const handlePerPageSelect = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPerPage: number) => {
- setPerPageOption(newPerPage);
- if(broker.storageColumnLocation) {
- artemisPreferencesService.saveTablePageSize(broker.storageColumnLocation, newPerPage)
- }
if (newPerPage === -1) {
setIsCompact(true);
setPerPage(resultsSize);
@@ -240,6 +243,9 @@ const operationOptions = [
setPerPage(newPerPage);
}
setPage(1);
+ if(broker.storageColumnLocation) {
+ artemisPreferencesService.saveTablePageSize(broker.storageColumnLocation, newPerPage)
+ }
};
const getKeyByValue = (producer: never, columnName: string) => {
@@ -269,7 +275,7 @@ const operationOptions = [
<Pagination
itemCount={resultsSize}
page={page}
- perPage={perPageOption}
+ perPage={perPage}
onSetPage={handleSetPage}
onPerPageSelect={handlePerPageSelect}
isCompact={isCompact}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@artemis.apache.org
For additional commands, e-mail: commits-help@artemis.apache.org