@@ -7,29 +7,39 @@ import {ResizeableDataTable} from '../ResizeableDataTable/ResizeableDataTable';
7
7
import { shardsColumnIdToGetColumn } from './columns' ;
8
8
import type { TopShardsColumnId } from './constants' ;
9
9
import { TOP_SHARDS_COLUMNS_WIDTH_LS_KEY , isSortableTopShardsColumn } from './constants' ;
10
+ import type { ShardsColumn } from './types' ;
10
11
11
12
export interface ShardsTableProps
12
13
extends Omit < ResizeableDataTableProps < KeyValueRow > , 'columnsWidthLSKey' | 'columns' > {
13
14
columnsIds : TopShardsColumnId [ ] ;
14
15
database : string ;
16
+ columns ?: ShardsColumn [ ] ;
15
17
schemaPath ?: string ;
16
18
}
17
19
18
- export function ShardsTable ( { columnsIds, schemaPath, database, ...props } : ShardsTableProps ) {
19
- const columns = React . useMemo (
20
- ( ) =>
21
- columnsIds
22
- . filter ( ( id ) => id in shardsColumnIdToGetColumn )
23
- . map ( ( id ) => {
24
- const column = shardsColumnIdToGetColumn [ id ] ( { database, schemaPath} ) ;
20
+ export function ShardsTable ( {
21
+ columnsIds,
22
+ schemaPath,
23
+ database,
24
+ columns : propsColumns ,
25
+ ...props
26
+ } : ShardsTableProps ) {
27
+ const columns = React . useMemo ( ( ) => {
28
+ if ( propsColumns ) {
29
+ return propsColumns ;
30
+ }
25
31
26
- return {
27
- ...column ,
28
- sortable : isSortableTopShardsColumn ( column . name ) ,
29
- } ;
30
- } ) ,
31
- [ columnsIds , database , schemaPath ] ,
32
- ) ;
32
+ return columnsIds
33
+ . filter ( ( id ) => id in shardsColumnIdToGetColumn )
34
+ . map ( ( id ) => {
35
+ const column = shardsColumnIdToGetColumn [ id ] ( { database, schemaPath} ) ;
36
+
37
+ return {
38
+ ...column ,
39
+ sortable : isSortableTopShardsColumn ( column . name ) ,
40
+ } ;
41
+ } ) ;
42
+ } , [ columnsIds , database , propsColumns , schemaPath ] ) ;
33
43
34
44
return (
35
45
< ResizeableDataTable
0 commit comments