mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-06 14:39:35 +08:00
🐛 fix(connection): 修复连接颜色重启丢失并同步标签页展示
- 恢复连接清洗流程中的图标类型与颜色字段 - 标签页增加连接色标识,便于区分多连接会话 - 抽取连接视觉解析并补充回归测试 Refs #334
This commit is contained in:
@@ -243,6 +243,18 @@ const sanitizeAddressList = (value: unknown): string[] => {
|
||||
return all.slice(0, MAX_HOST_ENTRIES);
|
||||
};
|
||||
|
||||
const sanitizeConnectionIconType = (value: unknown): string | undefined => {
|
||||
const iconType = toTrimmedString(value).toLowerCase();
|
||||
return iconType || undefined;
|
||||
};
|
||||
|
||||
const sanitizeConnectionIconColor = (value: unknown): string | undefined => {
|
||||
const color = toTrimmedString(value);
|
||||
return /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(color)
|
||||
? color
|
||||
: undefined;
|
||||
};
|
||||
|
||||
const normalizeConnectionType = (value: unknown): string => {
|
||||
const type = toTrimmedString(value).toLowerCase();
|
||||
if (type === "doris") {
|
||||
@@ -574,6 +586,8 @@ const sanitizeSavedConnection = (
|
||||
includeDatabases.length > 0 ? includeDatabases : undefined,
|
||||
includeRedisDatabases:
|
||||
includeRedisDatabases.length > 0 ? includeRedisDatabases : undefined,
|
||||
iconType: sanitizeConnectionIconType(raw.iconType),
|
||||
iconColor: sanitizeConnectionIconColor(raw.iconColor),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user