Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/components/InfoViewer/schemaInfo/TableIndexInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {InfoViewerItem} from '..';
import {InfoViewer} from '..';
import {getEntityName} from '../../../containers/Tenant/utils';
import {EIndexType} from '../../../types/api/schema';
import type {TEvDescribeSchemeResult} from '../../../types/api/schema';

import i18n from './i18n';
Expand All @@ -22,16 +23,17 @@ export const TableIndexInfo = ({data}: TableIndexInfoProps) => {

const vectorSettings = TableIndex?.VectorIndexKmeansTreeDescription?.Settings;

if (!vectorSettings) {
return <InfoViewer title={entityName} info={info} />;
}
const isVectorIndex = TableIndex?.Type === EIndexType.EIndexTypeGlobalVectorKmeansTree;

const vectorInfo: Array<InfoViewerItem> = buildVectorIndexInfo(vectorSettings);
if (isVectorIndex) {
const vectorInfo: Array<InfoViewerItem> = buildVectorIndexInfo(vectorSettings);
return (
<>
<InfoViewer title={i18n('title_vector-index')} info={info} />
<InfoViewer info={vectorInfo} />
</>
);
}

return (
<>
<InfoViewer title={entityName} info={info} />
<InfoViewer title={i18n('title_vector-index')} info={vectorInfo} />
</>
);
return <InfoViewer title={entityName} info={info} />;
};
1 change: 1 addition & 0 deletions src/components/InfoViewer/schemaInfo/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function buildVectorIndexInfo(vectorSettings?: VectorSettings): InfoViewe
const settingsFormatter = createInfoFormatter<TVectorIndexKmeansTreeDescriptionSettingsInner>({
values: {
vector_dimension: (v) => (typeof v === 'number' ? formatNumber(v) : v),
vector_type: (v) => (typeof v === 'string' ? v.replace(/^VECTOR_TYPE_/, '') : v),
},
labels: {
vector_dimension: i18n('field_vector-dimension'),
Expand Down
4 changes: 2 additions & 2 deletions src/types/api/schema/tableIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export interface TIndexDescription {
VectorIndexKmeansTreeDescription?: TVectorIndexKmeansTreeDescription;
}

enum EIndexType {
export enum EIndexType {
EIndexTypeInvalid = 'EIndexTypeInvalid',
EIndexTypeGlobal = 'EIndexTypeGlobal',
EIndexTypeGlobalAsync = 'EIndexTypeGlobalAsync',
EIndexTypeGlobalVectorKmeansTree = 'EIndexTypeGlobalVectorKmeansTree',
}

enum EIndexState {
export enum EIndexState {
EIndexStateInvalid = 'EIndexStateInvalid',
EIndexStateReady = 'EIndexStateReady',
EIndexStateNotReady = 'EIndexStateNotReady',
Expand Down
Loading