This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-06 12:54:12 +01:00
parent 8fd8b9319d
commit 05a2fb5846
2 changed files with 5 additions and 5 deletions

View File

@@ -5,7 +5,7 @@ import { Link } from '@tanstack/react-router';
import type { ColumnDef } from '@tanstack/react-table'; import type { ColumnDef } from '@tanstack/react-table';
import type { IServiceGroup } from '@openpanel/db'; import type { IServiceGroup } from '@openpanel/db';
type IServiceGroupWithStats = IServiceGroup & { export type IServiceGroupWithStats = IServiceGroup & {
memberCount: number; memberCount: number;
lastActiveAt: Date | null; lastActiveAt: Date | null;
}; };

View File

@@ -3,7 +3,7 @@ import type { UseQueryResult } from '@tanstack/react-query';
import type { PaginationState, Table, Updater } from '@tanstack/react-table'; import type { PaginationState, Table, Updater } from '@tanstack/react-table';
import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; import { getCoreRowModel, useReactTable } from '@tanstack/react-table';
import { memo } from 'react'; import { memo } from 'react';
import { useGroupColumns } from './columns'; import { type IServiceGroupWithStats, useGroupColumns } from './columns';
import { DataTable } from '@/components/ui/data-table/data-table'; import { DataTable } from '@/components/ui/data-table/data-table';
import { import {
useDataTableColumnVisibility, useDataTableColumnVisibility,
@@ -26,7 +26,7 @@ interface Props {
toolbarLeft?: React.ReactNode; toolbarLeft?: React.ReactNode;
} }
const LOADING_DATA = [{}, {}, {}, {}, {}, {}, {}, {}, {}] as IServiceGroup[]; const LOADING_DATA = [{}, {}, {}, {}, {}, {}, {}, {}, {}] as IServiceGroupWithStats[];
export const GroupsTable = memo( export const GroupsTable = memo(
({ query, pageSize = PAGE_SIZE, toolbarLeft }: Props) => { ({ query, pageSize = PAGE_SIZE, toolbarLeft }: Props) => {
@@ -69,7 +69,7 @@ export const GroupsTable = memo(
: updaterOrValue; : updaterOrValue;
setPage(nextPagination.pageIndex + 1); setPage(nextPagination.pageIndex + 1);
}, },
getRowId: (row, index) => (row as IServiceGroup).id ?? `loading-${index}`, getRowId: (row, index) => row.id ?? `loading-${index}`,
}); });
return ( return (
@@ -94,7 +94,7 @@ function GroupsTableToolbar({
table, table,
toolbarLeft, toolbarLeft,
}: { }: {
table: Table<IServiceGroup>; table: Table<IServiceGroupWithStats>;
toolbarLeft?: React.ReactNode; toolbarLeft?: React.ReactNode;
}) { }) {
const { search, setSearch } = useSearchQueryState(); const { search, setSearch } = useSearchQueryState();