Skip to content

Commit ff52974

Browse files
fix: review
1 parent b8af488 commit ff52974

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/components/ShardsTable/ShardsTable.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export function ShardsTable({columnsIds, schemaPath, database, ...props}: Shards
1919
const columns = React.useMemo(
2020
() =>
2121
columnsIds
22+
.filter((id) => id in shardsColumnIdToGetColumn)
2223
.map((id) => {
23-
return shardsColumnIdToGetColumn[id]({database, schemaPath});
24-
})
25-
.map((column) => {
24+
const column = shardsColumnIdToGetColumn[id]({database, schemaPath});
25+
2626
return {
2727
...column,
2828
sortable: isSortableTopShardsColumn(column.name),

src/components/ShardsTable/columns.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {LinkToSchemaObject} from '../LinkToSchemaObject/LinkToSchemaObject';
99
import {TabletNameWrapper} from '../TabletNameWrapper/TabletNameWrapper';
1010
import {UsageLabel} from '../UsageLabel/UsageLabel';
1111

12+
import type {TopShardsColumnId} from './constants';
1213
import {TOP_SHARDS_COLUMNS_IDS, TOP_SHARDS_COLUMNS_TITLES} from './constants';
1314
import type {GetShardsColumn} from './types';
1415
import {prepareDateTimeValue} from './utils';
@@ -100,7 +101,7 @@ export const getIntervalEndColumn: GetShardsColumn = () => {
100101
};
101102
};
102103

103-
export const shardsColumnIdToGetColumn = {
104+
export const shardsColumnIdToGetColumn: Record<TopShardsColumnId, GetShardsColumn> = {
104105
[TOP_SHARDS_COLUMNS_IDS.Path]: getPathColumn,
105106
[TOP_SHARDS_COLUMNS_IDS.DataSize]: getDataSizeColumn,
106107
[TOP_SHARDS_COLUMNS_IDS.TabletId]: getTabletIdColumn,

src/components/ShardsTable/types.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {Column} from '@gravity-ui/react-data-table';
22

33
import type {KeyValueRow} from '../../types/api/query';
44

5-
export type GetShardsColumn = (params: {
6-
database: string;
7-
schemaPath?: string;
8-
}) => Column<KeyValueRow>;
5+
export type ShardsColumn = Column<KeyValueRow>;
6+
7+
export type GetShardsColumn = (params: {database: string; schemaPath?: string}) => ShardsColumn;

0 commit comments

Comments
 (0)