@@ -4,29 +4,29 @@ import {
44} from "@flanksource-ui/api/types/playbooks" ;
55import { User } from "@flanksource-ui/api/types/users" ;
66import { Avatar } from "@flanksource-ui/ui/Avatar" ;
7- import { DataTable , PaginationOptions } from "@flanksource-ui/ui/DataTable" ;
8- import { DateCell } from "@flanksource-ui/ui/DataTable/Cells/DateCells" ;
97import FormatDuration from "@flanksource-ui/ui/Dates/FormatDuration" ;
108import { ConfigIcon } from "@flanksource-ui/ui/Icons/ConfigIcon" ;
119import { Icon } from "@flanksource-ui/ui/Icons/Icon" ;
12- import { ColumnDef } from "@tanstack/react-table" ;
10+ import { MRTDateCell } from "@flanksource-ui/ui/MRTDataTable/Cells/MRTDateCells" ;
11+ import MRTDataTable from "@flanksource-ui/ui/MRTDataTable/MRTDataTable" ;
12+ import { MRT_ColumnDef } from "mantine-react-table" ;
1313import { useCallback } from "react" ;
1414import { useNavigate } from "react-router-dom" ;
1515import PlaybookSpecIcon from "../Settings/PlaybookSpecIcon" ;
1616import { PlaybookStatusDescription } from "./PlaybookRunsStatus" ;
1717
18- const playbookRunsTableColumns : ColumnDef < PlaybookRun > [ ] = [
18+ const playbookRunsTableColumns : MRT_ColumnDef < PlaybookRun > [ ] = [
1919 {
2020 header : "Name" ,
2121 accessorKey : "name" ,
22- cell : ( { row } ) => {
22+ Cell : ( { row } ) => {
2323 return < PlaybookSpecIcon playbook = { row . original . playbooks ! } showLabel /> ;
2424 } ,
2525 size : 400
2626 } ,
2727 {
2828 header : "Resource" ,
29- cell : ( { row } ) => {
29+ Cell : ( { row } ) => {
3030 const component = row . original . component ;
3131 const componentId = row . original . component_id ;
3232 const configId = row . original . config_id ;
@@ -65,21 +65,21 @@ const playbookRunsTableColumns: ColumnDef<PlaybookRun>[] = [
6565 {
6666 header : "Status" ,
6767 accessorKey : "status" ,
68- cell : ( { getValue } ) => {
69- const status = getValue < PlaybookRunStatus > ( ) ;
68+ Cell : ( { cell } ) => {
69+ const status = cell . getValue < PlaybookRunStatus > ( ) ;
7070 return < PlaybookStatusDescription status = { status } /> ;
7171 }
7272 } ,
7373 {
7474 header : "Date" ,
7575 accessorKey : "start_time" ,
76- cell : DateCell ,
76+ Cell : MRTDateCell ,
7777 sortingFn : "datetime"
7878 } ,
7979 {
8080 header : "Duration" ,
8181 accessorKey : "duration" ,
82- cell : ( { row } ) => {
82+ Cell : ( { row } ) => {
8383 return (
8484 < FormatDuration
8585 startTime = { row . original . start_time }
@@ -91,14 +91,14 @@ const playbookRunsTableColumns: ColumnDef<PlaybookRun>[] = [
9191 {
9292 header : "Created At" ,
9393 accessorKey : "created_at" ,
94- cell : DateCell ,
94+ Cell : MRTDateCell ,
9595 sortingFn : "datetime"
9696 } ,
9797 {
9898 header : "Created By" ,
9999 accessorKey : "created_by" ,
100- cell : ( { getValue } ) => {
101- const user = getValue < User > ( ) ;
100+ Cell : ( { cell } ) => {
101+ const user = cell . getValue < User > ( ) ;
102102 return < Avatar user = { user } circular /> ;
103103 }
104104 }
@@ -107,14 +107,15 @@ const playbookRunsTableColumns: ColumnDef<PlaybookRun>[] = [
107107type Props = {
108108 data : PlaybookRun [ ] ;
109109 isLoading ?: boolean ;
110- pagination ?: PaginationOptions ;
111- } & Omit < React . HTMLProps < HTMLDivElement > , "data" > ;
110+ numberOfPages ?: number ;
111+ totalRecords ?: number ;
112+ } ;
112113
113114export default function PlaybookRunsTable ( {
114115 data,
115116 isLoading,
116- className ,
117- ... rest
117+ numberOfPages ,
118+ totalRecords
118119} : Props ) {
119120 const navigate = useNavigate ( ) ;
120121
@@ -126,17 +127,16 @@ export default function PlaybookRunsTable({
126127 ) ;
127128
128129 return (
129- < div className = "flex flex-1 flex-col overflow-y-hidden" { ...rest } >
130- < DataTable
131- stickyHead
130+ < div className = "flex flex-1 flex-col overflow-y-hidden" >
131+ < MRTDataTable
132132 columns = { playbookRunsTableColumns }
133133 data = { data }
134- tableStyle = { { borderSpacing : "0" } }
135134 isLoading = { isLoading }
136- preferencesKey = "connections-list"
137- savePreferences = { false }
138- handleRowClick = { ( row ) => onRowClick ( row . original ) }
139- className = "overflow-x-hidden"
135+ onRowClick = { ( row ) => onRowClick ( row ) }
136+ manualPageCount = { numberOfPages }
137+ totalRowCount = { totalRecords }
138+ enableServerSidePagination
139+ enableServerSideSorting
140140 />
141141 </ div >
142142 ) ;
0 commit comments