wip
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user