diff --git a/frontend/src/admin/sections/BackupsSection.svelte b/frontend/src/admin/sections/BackupsSection.svelte index a7f677f..921a272 100644 --- a/frontend/src/admin/sections/BackupsSection.svelte +++ b/frontend/src/admin/sections/BackupsSection.svelte @@ -105,6 +105,10 @@ if (index >= 0) backupsPage = Math.floor(index / BACKUPS_PAGE_SIZE); } + function setBackupsPage(page) { + backupsPage = Math.min(Math.max(0, Number(page) || 0), backupsPageCount - 1); + } + function warningsText(warnings) { return (warnings || []).filter(Boolean).join("\n"); } @@ -336,12 +340,16 @@ {#if totalArchives > BACKUPS_PAGE_SIZE} = backupsPageCount - 1} - onPrev={() => (backupsPage = Math.max(0, backupsPage - 1))} - onNext={() => (backupsPage = Math.min(backupsPageCount - 1, backupsPage + 1))} + onPageChange={setBackupsPage} /> {/if} {/if} diff --git a/frontend/src/admin/sections/LogsSection.svelte b/frontend/src/admin/sections/LogsSection.svelte index d0de85b..970d0c2 100644 --- a/frontend/src/admin/sections/LogsSection.svelte +++ b/frontend/src/admin/sections/LogsSection.svelte @@ -15,10 +15,11 @@ export let onOpenUserCard = () => {}; const logsStore = getContext("logsStore"); + const LOGS_PAGE_SIZE = 50; $: ({ logs, logsTotal, logsPage, logsUserFilter, logsLoading } = $logsStore); - $: logsHasMore = logs.length > 0 && logsTotal > (logsPage + 1) * 50; // 50 is LOGS_PAGE_SIZE + $: logsPageCount = Math.max(1, Math.ceil(Number(logsTotal || 0) / LOGS_PAGE_SIZE)); $: logHeaders = [ at("date", {}, "Дата"), at("event", {}, "Событие"), @@ -165,17 +166,18 @@ { - logsStore.setPage(Math.max(0, logsPage - 1)); - }} - onNext={() => { - logsStore.setPage(logsPage + 1); - }} + onPageChange={(page) => logsStore.setPage(page)} />