diff --git a/frontend/src/routes/dashboards/+page.svelte b/frontend/src/routes/dashboards/+page.svelte index 19b670ba..39c269bf 100644 --- a/frontend/src/routes/dashboards/+page.svelte +++ b/frontend/src/routes/dashboards/+page.svelte @@ -25,9 +25,9 @@ import DashboardMaintenanceBadge from "$lib/components/DashboardMaintenanceBadge.svelte"; import { environmentContextStore, initializeEnvironmentContext, setSelectedEnvironment } from "$lib/stores/environmentContext.svelte.js"; - import { Button, Skeleton } from "$lib/ui"; + import { Button, Pagination, Skeleton } from "$lib/ui"; import ColumnFilterPopover from "./ColumnFilterPopover.svelte"; - import { formatDate, getPaginationRange, getSortIndicator } from "./dashboard-helpers.js"; + import { formatDate, getSortIndicator } from "./dashboard-helpers.js"; import { DashboardHubModel } from "$lib/models/DashboardHubModel.svelte.ts"; import MigrateDashboardModal from "./MigrateDashboardModal.svelte"; import BackupDashboardModal from "./BackupDashboardModal.svelte"; @@ -52,6 +52,26 @@ setSelectedEnvironment(envId); } + // ── Pagination bridge (0-indexed ↔ 1-indexed) ── + let pageZero = $state(m.currentPage - 1); + + $effect(() => { + if (pageZero + 1 !== m.currentPage) { + m.setPage(pageZero + 1); + } + }); + + $effect(() => { + if (m.currentPage - 1 !== pageZero) { + pageZero = m.currentPage - 1; + } + }); + + function handlePageSizeChange(size: number) { + m.pageSize = size; + m.currentPage = 1; + } + // Store-derived values (must stay in page — legacy store not reactive in Model) let environments = $derived($environmentContextStore?.environments || []); let shouldShowEnvironmentWizard = $derived( @@ -656,81 +676,14 @@ class="inline-flex h-8 w-8 items-center justify-center rounded-md border border- {#if m.totalPages > 1} -
-
- {($t.dashboard?.showing ?? '') - .replace("{start}", String((m.currentPage - 1) * m.pageSize + 1)) - .replace("{end}", String(Math.min(m.currentPage * m.pageSize, m.total))) - .replace("{total}", String(m.total))} -
-
- - - {#each getPaginationRange(m.currentPage, m.totalPages) as pageNum} - {#if pageNum === "..."} - ... - {:else} - - {/if} - {/each} - - -
-
- -
-
+ {/if} diff --git a/frontend/src/routes/datasets/DatasetList.svelte b/frontend/src/routes/datasets/DatasetList.svelte index 0ccebb65..a7c7ac5c 100644 --- a/frontend/src/routes/datasets/DatasetList.svelte +++ b/frontend/src/routes/datasets/DatasetList.svelte @@ -10,7 +10,7 @@ @@ -167,18 +182,11 @@ {#if totalPages > 1} -
- - {($t.datasets?.showing ?? 'Showing {start}-{end} of {total}').replace('{start}', String((page - 1) * pageSize + 1)).replace('{end}', String(Math.min(page * pageSize, total))).replace('{total}', String(total))} - -
- - - {page} / {totalPages} - - -
-
+ {/if} {/if} \ No newline at end of file diff --git a/frontend/src/routes/validation-tasks/+page.svelte b/frontend/src/routes/validation-tasks/+page.svelte index b491ef4e..a3d7989d 100644 --- a/frontend/src/routes/validation-tasks/+page.svelte +++ b/frontend/src/routes/validation-tasks/+page.svelte @@ -10,7 +10,7 @@
@@ -178,16 +187,11 @@ {#if m.totalPages > 1} -
-

{($t.validation?.showing || 'Showing {count} of {total}').replace('{count}', String(m.tasks.length)).replace('{total}', String(m.total))}

- -
+ {/if} {/if}