mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-04 01:36:39 +00:00
Format
This commit is contained in:
@@ -956,12 +956,7 @@ export async function rebuildClientAssociationsFromClient(
|
|||||||
/////////// Send messages ///////////
|
/////////// Send messages ///////////
|
||||||
|
|
||||||
// Handle messages for sites being added
|
// Handle messages for sites being added
|
||||||
await handleMessagesForClientSites(
|
await handleMessagesForClientSites(client, sitesToAdd, sitesToRemove, trx);
|
||||||
client,
|
|
||||||
sitesToAdd,
|
|
||||||
sitesToRemove,
|
|
||||||
trx
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle subnet proxy target updates for resources
|
// Handle subnet proxy target updates for resources
|
||||||
await handleMessagesForClientResources(
|
await handleMessagesForClientResources(
|
||||||
|
|||||||
@@ -43,13 +43,15 @@ export function DataTablePagination<TData>({
|
|||||||
|
|
||||||
// Use controlled values if provided, otherwise fall back to table state
|
// Use controlled values if provided, otherwise fall back to table state
|
||||||
const pageSize = controlledPageSize ?? table.getState().pagination.pageSize;
|
const pageSize = controlledPageSize ?? table.getState().pagination.pageSize;
|
||||||
const pageIndex = controlledPageIndex ?? table.getState().pagination.pageIndex;
|
const pageIndex =
|
||||||
|
controlledPageIndex ?? table.getState().pagination.pageIndex;
|
||||||
|
|
||||||
// Calculate page boundaries based on controlled state
|
// Calculate page boundaries based on controlled state
|
||||||
// For server-side pagination, use totalCount if available for accurate page count
|
// For server-side pagination, use totalCount if available for accurate page count
|
||||||
const pageCount = isServerPagination && totalCount !== undefined
|
const pageCount =
|
||||||
? Math.ceil(totalCount / pageSize)
|
isServerPagination && totalCount !== undefined
|
||||||
: table.getPageCount();
|
? Math.ceil(totalCount / pageSize)
|
||||||
|
: table.getPageCount();
|
||||||
const canNextPage = pageIndex < pageCount - 1;
|
const canNextPage = pageIndex < pageCount - 1;
|
||||||
const canPreviousPage = pageIndex > 0;
|
const canPreviousPage = pageIndex > 0;
|
||||||
|
|
||||||
@@ -125,9 +127,7 @@ export function DataTablePagination<TData>({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-8 w-[73px]" disabled={disabled}>
|
<SelectTrigger className="h-8 w-[73px]" disabled={disabled}>
|
||||||
<SelectValue
|
<SelectValue placeholder={pageSize} />
|
||||||
placeholder={pageSize}
|
|
||||||
/>
|
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent side="bottom">
|
<SelectContent side="bottom">
|
||||||
{[10, 20, 30, 40, 50, 100].map((pageSize) => (
|
{[10, 20, 30, 40, 50, 100].map((pageSize) => (
|
||||||
@@ -156,9 +156,7 @@ export function DataTablePagination<TData>({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="hidden h-8 w-8 p-0 lg:flex"
|
className="hidden h-8 w-8 p-0 lg:flex"
|
||||||
onClick={() => handlePageNavigation("first")}
|
onClick={() => handlePageNavigation("first")}
|
||||||
disabled={
|
disabled={!canPreviousPage || isLoading || disabled}
|
||||||
!canPreviousPage || isLoading || disabled
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span className="sr-only">{t("paginatorToFirst")}</span>
|
<span className="sr-only">{t("paginatorToFirst")}</span>
|
||||||
<DoubleArrowLeftIcon className="h-4 w-4" />
|
<DoubleArrowLeftIcon className="h-4 w-4" />
|
||||||
@@ -167,9 +165,7 @@ export function DataTablePagination<TData>({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 w-8 p-0"
|
className="h-8 w-8 p-0"
|
||||||
onClick={() => handlePageNavigation("previous")}
|
onClick={() => handlePageNavigation("previous")}
|
||||||
disabled={
|
disabled={!canPreviousPage || isLoading || disabled}
|
||||||
!canPreviousPage || isLoading || disabled
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span className="sr-only">
|
<span className="sr-only">
|
||||||
{t("paginatorToPrevious")}
|
{t("paginatorToPrevious")}
|
||||||
@@ -180,9 +176,7 @@ export function DataTablePagination<TData>({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 w-8 p-0"
|
className="h-8 w-8 p-0"
|
||||||
onClick={() => handlePageNavigation("next")}
|
onClick={() => handlePageNavigation("next")}
|
||||||
disabled={
|
disabled={!canNextPage || isLoading || disabled}
|
||||||
!canNextPage || isLoading || disabled
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span className="sr-only">{t("paginatorToNext")}</span>
|
<span className="sr-only">{t("paginatorToNext")}</span>
|
||||||
<ChevronRightIcon className="h-4 w-4" />
|
<ChevronRightIcon className="h-4 w-4" />
|
||||||
@@ -191,9 +185,7 @@ export function DataTablePagination<TData>({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="hidden h-8 w-8 p-0 lg:flex"
|
className="hidden h-8 w-8 p-0 lg:flex"
|
||||||
onClick={() => handlePageNavigation("last")}
|
onClick={() => handlePageNavigation("last")}
|
||||||
disabled={
|
disabled={!canNextPage || isLoading || disabled}
|
||||||
!canNextPage || isLoading || disabled
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span className="sr-only">{t("paginatorToLast")}</span>
|
<span className="sr-only">{t("paginatorToLast")}</span>
|
||||||
<DoubleArrowRightIcon className="h-4 w-4" />
|
<DoubleArrowRightIcon className="h-4 w-4" />
|
||||||
|
|||||||
@@ -296,12 +296,16 @@ export function DataTable<TData, TValue>({
|
|||||||
const handleTabChange = (value: string) => {
|
const handleTabChange = (value: string) => {
|
||||||
setActiveTab(value);
|
setActiveTab(value);
|
||||||
// Reset to first page when changing tabs
|
// Reset to first page when changing tabs
|
||||||
setPagination(prev => ({ ...prev, pageIndex: 0 }));
|
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enhanced pagination component that updates our local state
|
// Enhanced pagination component that updates our local state
|
||||||
const handlePageSizeChange = (newPageSize: number) => {
|
const handlePageSizeChange = (newPageSize: number) => {
|
||||||
setPagination(prev => ({ ...prev, pageSize: newPageSize, pageIndex: 0 }));
|
setPagination((prev) => ({
|
||||||
|
...prev,
|
||||||
|
pageSize: newPageSize,
|
||||||
|
pageIndex: 0
|
||||||
|
}));
|
||||||
setPageSize(newPageSize);
|
setPageSize(newPageSize);
|
||||||
|
|
||||||
// Persist immediately when changed
|
// Persist immediately when changed
|
||||||
|
|||||||
Reference in New Issue
Block a user