mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-18 03:02:56 +00:00
feat: add go-to-page input to Docker events pagination
This commit is contained in:
@@ -365,6 +365,38 @@ export const ShowDockerEvents = ({ serverId }: Props) => {
|
|||||||
Page {table.getState().pagination.pageIndex + 1} of{" "}
|
Page {table.getState().pagination.pageIndex + 1} of{" "}
|
||||||
{table.getPageCount()}
|
{table.getPageCount()}
|
||||||
</span>
|
</span>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Go to</span>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
min={1}
|
||||||
|
max={table.getPageCount()}
|
||||||
|
defaultValue={table.getState().pagination.pageIndex + 1}
|
||||||
|
key={table.getState().pagination.pageIndex}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key !== "Enter") return;
|
||||||
|
const value = Number(
|
||||||
|
(e.target as HTMLInputElement).value,
|
||||||
|
);
|
||||||
|
if (!Number.isFinite(value)) return;
|
||||||
|
const page = Math.min(
|
||||||
|
Math.max(value, 1),
|
||||||
|
table.getPageCount(),
|
||||||
|
);
|
||||||
|
table.setPageIndex(page - 1);
|
||||||
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
if (!Number.isFinite(value)) return;
|
||||||
|
const page = Math.min(
|
||||||
|
Math.max(value, 1),
|
||||||
|
table.getPageCount(),
|
||||||
|
);
|
||||||
|
table.setPageIndex(page - 1);
|
||||||
|
}}
|
||||||
|
className="w-16 h-8"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
Reference in New Issue
Block a user