From 004abfe10b28bf9a32486c01af86278a3e44dc5f Mon Sep 17 00:00:00 2001 From: CHEYNE Date: Fri, 19 Jan 2024 14:52:05 +0800 Subject: [PATCH 1/2] fix click tree table error --- web/components/ColumnTypeChip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/components/ColumnTypeChip.js b/web/components/ColumnTypeChip.js index 0038dded2a2..f56d4a4ac20 100644 --- a/web/components/ColumnTypeChip.js +++ b/web/components/ColumnTypeChip.js @@ -10,9 +10,9 @@ 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 label = isString(type) ? type : `${type?.type}<${type?.elementType ?? 'unknown'}>` ?? 'unknown' const columnTypeColor = ColumnTypeColorEnum[type] || 'secondary' const color = colors[columnTypeColor]?.main || '#8592A3' From b90f5303f807501c826fa4c7af5764676d66bbe1 Mon Sep 17 00:00:00 2001 From: CHEYNE Date: Fri, 19 Jan 2024 15:23:33 +0800 Subject: [PATCH 2/2] format type string character --- web/components/ColumnTypeChip.js | 4 +++- web/lib/enums/columnTypeEnum.ts | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/components/ColumnTypeChip.js b/web/components/ColumnTypeChip.js index f56d4a4ac20..04f5b42eb36 100644 --- a/web/components/ColumnTypeChip.js +++ b/web/components/ColumnTypeChip.js @@ -12,9 +12,11 @@ import { isString } from 'lodash-es' const ColumnTypeChip = props => { const { type = '' } = props + const formatType = type && isString(type) ? type.replace(/\(.*\)/, '') : type + const label = isString(type) ? type : `${type?.type}<${type?.elementType ?? 'unknown'}>` ?? 'unknown' - const columnTypeColor = ColumnTypeColorEnum[type] || 'secondary' + 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',