-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update settings table to use mantine-react-table
This provides more features and better performance than the previous implementation. This also includes a new pagination hook that can be used in other tables. Fixes #2080
- Loading branch information
1 parent
0f32b90
commit b07f0c4
Showing
23 changed files
with
1,077 additions
and
531 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,27 @@ | ||
import { SchemaResourceWithJobStatus } from "@flanksource-ui/api/schemaResources"; | ||
import { DataTable, PaginationOptions } from "@flanksource-ui/ui/DataTable"; | ||
import { PaginationState, Updater } from "@tanstack/react-table"; | ||
import { useMemo } from "react"; | ||
import MRTDataTable from "@flanksource-ui/ui/MRTDataTable/MRTDataTable"; | ||
import { integrationsTableColumns } from "./Table/IntegrationsTableColumns"; | ||
|
||
type IntegrationsListProps = { | ||
data: SchemaResourceWithJobStatus[]; | ||
onRowClick: (row: SchemaResourceWithJobStatus) => void; | ||
pageCount: number; | ||
pageIndex: number; | ||
pageSize: number; | ||
isLoading: boolean; | ||
setPageState?: (state: Updater<PaginationState>) => void; | ||
isLoading?: boolean; | ||
pageCount?: number; | ||
}; | ||
|
||
export default function IntegrationsList({ | ||
data, | ||
onRowClick, | ||
pageCount, | ||
pageIndex, | ||
pageSize, | ||
isLoading = false, | ||
setPageState = () => {} | ||
pageCount | ||
}: IntegrationsListProps) { | ||
const pagination = useMemo(() => { | ||
return { | ||
setPagination: (state) => { | ||
setPageState(state); | ||
}, | ||
pageIndex, | ||
pageSize, | ||
pageCount, | ||
remote: true, | ||
enable: true, | ||
loading: isLoading | ||
} satisfies PaginationOptions; | ||
}, [setPageState, pageIndex, pageSize, pageCount, isLoading]); | ||
|
||
return ( | ||
<DataTable | ||
<MRTDataTable | ||
data={data} | ||
handleRowClick={(row) => onRowClick(row.original)} | ||
onRowClick={onRowClick} | ||
columns={integrationsTableColumns} | ||
pagination={pagination} | ||
isLoading={isLoading} | ||
groupBy={["integration_type"]} | ||
expandAllRows | ||
manualPageCount={pageCount} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.