Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#1540] fix(UI): Add default type color for the tag in table (#1542)

CHEYNEccdb892383d1
diff --git a/web/components/ColumnTypeChip.js b/web/components/ColumnTypeChip.js
index 5010c96f7d..0038dded2a 100644
--- a/web/components/ColumnTypeChip.js
+++ b/web/components/ColumnTypeChip.js
@@ -7,20 +7,19 @@ import { Chip } from '@mui/material'
import { ColumnTypeColorEnum } from '@/lib/enums/columnTypeEnum'
import colors from '@/lib/theme/colors'
import { alpha } from '@/lib/utils/color'
+import { isString } from 'lodash-es'
const ColumnTypeChip = props => {
const { type } = props
- const bgColor = alpha(colors[ColumnTypeColorEnum[type]].main, 0.1)
+ const label = isString(type) ? type : `${type.type}<${type.elementType ?? 'unknown'}>` ?? 'unknown'
+
+ const columnTypeColor = ColumnTypeColorEnum[type] || 'secondary'
+ const color = colors[columnTypeColor]?.main || '#8592A3'
+ const bgColor = alpha(color, 0.1)
return (
- <Chip
- size='small'
- label={type}
- sx={{ backgroundColor: bgColor }}
- color={ColumnTypeColorEnum[type]}
- variant='outlined'
- />
+ <Chip size='small' label={label} sx={{ backgroundColor: bgColor }} color={columnTypeColor} variant='outlined' />
)
}