From f14509985da1b97f0ec86c008820f84714830296 Mon Sep 17 00:00:00 2001 From: CHEYNE Date: Fri, 19 Jan 2024 18:01:51 +0800 Subject: [PATCH] [#1611] fix(web): fix click tree table error (#1612) ### What changes were proposed in this pull request? Fix the issue of clicking on the `table` in the tree list. After: when clicked the `hive-schema-table` on the tree view. image ### Why are the changes needed? Fix: #1611 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? N/A --- web/components/ColumnTypeChip.js | 8 +++++--- web/lib/enums/columnTypeEnum.ts | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) 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',