Skip to content

Commit 3afa440

Browse files
committed
fix: remove index tables
1 parent 1a3a2ee commit 3afa440

File tree

4 files changed

+3
-134
lines changed

4 files changed

+3
-134
lines changed

src/containers/Operations/Operations.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {useAutoRefreshInterval} from '../../utils/hooks';
1010

1111
import {OperationsControls} from './OperationsControls';
1212
import {getColumns} from './columns';
13-
import {BASE_COLUMNS, BUILD_INDEX_COLUMNS} from './constants';
1413
import i18n from './i18n';
1514
import {b} from './shared';
1615
import {useOperationsQueryParams} from './useOperationsQueryParams';
@@ -47,14 +46,6 @@ export function Operations({database}: OperationsProps) {
4746
return <AccessDenied position="left" />;
4847
}
4948

50-
const columnsList: string[] = BASE_COLUMNS;
51-
52-
if (kind === 'buildindex') {
53-
columnsList.push(...BUILD_INDEX_COLUMNS);
54-
}
55-
56-
const columns = getColumns().filter(({name}) => columnsList.includes(name));
57-
5849
return (
5950
<TableWithControlsLayout>
6051
<TableWithControlsLayout.Controls>
@@ -72,7 +63,7 @@ export function Operations({database}: OperationsProps) {
7263
<TableWithControlsLayout.Table loading={isFetching} className={b('table')}>
7364
{data ? (
7465
<ResizeableDataTable
75-
columns={columns}
66+
columns={getColumns()}
7667
data={filteredOperations}
7768
emptyDataMessage={i18n('operations.noData')}
7869
/>

src/containers/Operations/columns.tsx

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import type {Column as DataTableColumn} from '@gravity-ui/react-data-table';
22
import {Text} from '@gravity-ui/uikit';
33

44
import {EntityStatus} from '../../components/EntityStatus/EntityStatus';
5-
import type {IndexBuildMetadata, TOperation} from '../../types/api/operationList';
5+
import type {TOperation} from '../../types/api/operationList';
66
import {EStatusCode} from '../../types/api/operationList';
77
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
88

99
import {COLUMNS_NAMES, COLUMNS_TITLES} from './constants';
10-
import i18n from './i18n';
1110

1211
export function getColumns(): DataTableColumn<TOperation>[] {
1312
return [
@@ -91,94 +90,5 @@ export function getColumns(): DataTableColumn<TOperation>[] {
9190
return Date.now() - new Date(row.create_time || '').getTime();
9291
},
9392
},
94-
{
95-
name: COLUMNS_NAMES.INDEX_BUILD_STATE,
96-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_BUILD_STATE],
97-
render: ({row}) => {
98-
const metadata = row.metadata as IndexBuildMetadata;
99-
if (!metadata || !metadata.state) {
100-
return EMPTY_DATA_PLACEHOLDER;
101-
}
102-
return metadata.state;
103-
},
104-
},
105-
{
106-
name: COLUMNS_NAMES.INDEX_BUILD_PROGRESS,
107-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_BUILD_PROGRESS],
108-
render: ({row}) => {
109-
const metadata = row.metadata as IndexBuildMetadata;
110-
if (!metadata || typeof metadata.progress !== 'number') {
111-
return EMPTY_DATA_PLACEHOLDER;
112-
}
113-
return `${metadata.progress}%`;
114-
},
115-
sortAccessor: (row) => {
116-
const metadata = row.metadata as IndexBuildMetadata;
117-
return metadata && typeof metadata.progress === 'number' ? metadata.progress : -1;
118-
},
119-
},
120-
{
121-
name: COLUMNS_NAMES.INDEX_NAME,
122-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_NAME],
123-
render: ({row}) => {
124-
const metadata = row.metadata as IndexBuildMetadata;
125-
if (!metadata || !metadata.description || !metadata.description.index) {
126-
return EMPTY_DATA_PLACEHOLDER;
127-
}
128-
return metadata.description.index.name || EMPTY_DATA_PLACEHOLDER;
129-
},
130-
},
131-
{
132-
name: COLUMNS_NAMES.INDEX_TYPE,
133-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_TYPE],
134-
render: ({row}) => {
135-
const metadata = row.metadata as IndexBuildMetadata;
136-
if (!metadata || !metadata.description || !metadata.description.index) {
137-
return EMPTY_DATA_PLACEHOLDER;
138-
}
139-
const index = metadata.description.index;
140-
if ('global_index' in index) {
141-
return i18n('indexType.globalIndex');
142-
}
143-
if ('global_async_index' in index) {
144-
return i18n('indexType.globalAsyncIndex');
145-
}
146-
if ('global_unique_index' in index) {
147-
return i18n('indexType.globalUniqueIndex');
148-
}
149-
if ('global_vector_kmeans_tree_index' in index) {
150-
return i18n('indexType.globalVectorKMeansTreeIndex');
151-
}
152-
return EMPTY_DATA_PLACEHOLDER;
153-
},
154-
},
155-
{
156-
name: COLUMNS_NAMES.INDEX_PATH,
157-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_PATH],
158-
render: ({row}) => {
159-
const metadata = row.metadata as IndexBuildMetadata;
160-
if (!metadata || !metadata.description || !metadata.description.path) {
161-
return EMPTY_DATA_PLACEHOLDER;
162-
}
163-
return metadata.description.path;
164-
},
165-
},
166-
{
167-
name: COLUMNS_NAMES.INDEX_COLUMNS,
168-
header: COLUMNS_TITLES[COLUMNS_NAMES.INDEX_COLUMNS],
169-
render: ({row}) => {
170-
const metadata = row.metadata as IndexBuildMetadata;
171-
if (
172-
!metadata ||
173-
!metadata.description ||
174-
!metadata.description.index ||
175-
!metadata.description.index.index_columns
176-
) {
177-
return EMPTY_DATA_PLACEHOLDER;
178-
}
179-
180-
return metadata.description.index.index_columns.join(', ');
181-
},
182-
},
18393
];
18494
}

src/containers/Operations/constants.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ export const COLUMNS_NAMES = {
1111
CREATE_TIME: 'create_time',
1212
END_TIME: 'end_time',
1313
DURATION: 'duration',
14-
INDEX_BUILD_STATE: 'index_build_state',
15-
INDEX_BUILD_PROGRESS: 'index_build_progress',
16-
INDEX_NAME: 'index_name',
17-
INDEX_TYPE: 'index_type',
18-
INDEX_PATH: 'index_path',
19-
INDEX_COLUMNS: 'index_columns',
2014
} as const;
2115

2216
export const COLUMNS_TITLES = {
@@ -26,12 +20,6 @@ export const COLUMNS_TITLES = {
2620
[COLUMNS_NAMES.CREATE_TIME]: i18n('column.createTime'),
2721
[COLUMNS_NAMES.END_TIME]: i18n('column.endTime'),
2822
[COLUMNS_NAMES.DURATION]: i18n('column.duration'),
29-
[COLUMNS_NAMES.INDEX_BUILD_STATE]: i18n('column.indexBuildState'),
30-
[COLUMNS_NAMES.INDEX_BUILD_PROGRESS]: i18n('column.indexBuildProgress'),
31-
[COLUMNS_NAMES.INDEX_NAME]: i18n('column.indexName'),
32-
[COLUMNS_NAMES.INDEX_TYPE]: i18n('column.indexType'),
33-
[COLUMNS_NAMES.INDEX_PATH]: i18n('column.indexPath'),
34-
[COLUMNS_NAMES.INDEX_COLUMNS]: i18n('column.indexColumns'),
3523
} as const;
3624

3725
export const BASE_COLUMNS = [
@@ -43,15 +31,6 @@ export const BASE_COLUMNS = [
4331
COLUMNS_NAMES.DURATION,
4432
];
4533

46-
export const BUILD_INDEX_COLUMNS = [
47-
COLUMNS_NAMES.INDEX_BUILD_STATE,
48-
COLUMNS_NAMES.INDEX_BUILD_PROGRESS,
49-
COLUMNS_NAMES.INDEX_NAME,
50-
COLUMNS_NAMES.INDEX_TYPE,
51-
COLUMNS_NAMES.INDEX_PATH,
52-
COLUMNS_NAMES.INDEX_COLUMNS,
53-
];
54-
5534
export const OPERATION_KINDS: {value: OperationKind; content: string}[] = [
5635
{value: 'ss/backgrounds', content: i18n('kind.ssBackgrounds')},
5736
{value: 'export', content: i18n('kind.export')},

src/containers/Operations/i18n/en.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,5 @@
3636
"column.createdBy": "Created By",
3737
"column.createTime": "Create Time",
3838
"column.endTime": "End Time",
39-
"column.duration": "Duration",
40-
"column.indexBuildState": "Index Build State",
41-
"column.indexBuildProgress": "Index Build Progress",
42-
"column.indexName": "Index Name",
43-
"column.indexType": "Index Type",
44-
"column.indexPath": "Index Path",
45-
"column.indexColumns": "Index Columns",
46-
47-
"indexType.globalIndex": "Global Index",
48-
"indexType.globalAsyncIndex": "Global Async Index",
49-
"indexType.globalUniqueIndex": "Global Unique Index",
50-
"indexType.globalVectorKMeansTreeIndex": "Global Vector KMeans Tree Index"
39+
"column.duration": "Duration"
5140
}

0 commit comments

Comments
 (0)