diff --git a/web/components/ColumnTypeChip.js b/web/components/ColumnTypeChip.js index 0038dded2a2..04f5b42eb36 100644 --- a/web/components/ColumnTypeChip.js +++ b/web/components/ColumnTypeChip.js @@ -10,11 +10,13 @@ import { alpha } from '@/lib/utils/color' import { isString } from 'lodash-es' const ColumnTypeChip = props => { - const { type } = props + const { type = '' } = props - const label = isString(type) ? type : `${type.type}<${type.elementType ?? 'unknown'}>` ?? 'unknown' + const formatType = type && isString(type) ? type.replace(/\(.*\)/, '') : type - const columnTypeColor = ColumnTypeColorEnum[type] || 'secondary' + const label = isString(type) ? type : `${type?.type}<${type?.elementType ?? 'unknown'}>` ?? 'unknown' + + const columnTypeColor = ColumnTypeColorEnum[formatType] || 'secondary' const color = colors[columnTypeColor]?.main || '#8592A3' const bgColor = alpha(color, 0.1) diff --git a/web/lib/enums/columnTypeEnum.ts b/web/lib/enums/columnTypeEnum.ts index fc0fcf3b074..115b4dab390 100644 --- a/web/lib/enums/columnTypeEnum.ts +++ b/web/lib/enums/columnTypeEnum.ts @@ -10,8 +10,8 @@ export enum ColumnTypeColorEnum { long = 'primary', float = 'primary', double = 'primary', - 'decimal(10,2)' = 'primary', - 'fixed(16)' = 'primary', + decimal = 'primary', + fixed = 'primary', date = 'info', time = 'info', @@ -21,8 +21,8 @@ export enum ColumnTypeColorEnum { interval_year = 'info', string = 'warning', - 'char(10)' = 'warning', - 'varchar(10)' = 'warning', + char = 'warning', + varchar = 'warning', byte = 'success', uuid = 'success',