@@ -2,12 +2,11 @@ import type {Column as DataTableColumn} from '@gravity-ui/react-data-table';
22import { Text } from '@gravity-ui/uikit' ;
33
44import { EntityStatus } from '../../components/EntityStatus/EntityStatus' ;
5- import type { IndexBuildMetadata , TOperation } from '../../types/api/operationList' ;
5+ import type { TOperation } from '../../types/api/operationList' ;
66import { EStatusCode } from '../../types/api/operationList' ;
77import { EMPTY_DATA_PLACEHOLDER } from '../../utils/constants' ;
88
99import { COLUMNS_NAMES , COLUMNS_TITLES } from './constants' ;
10- import i18n from './i18n' ;
1110
1211export 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}
0 commit comments