Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat: support empty redis key separator for flat key display

t8y26f15fa303cd0
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index f93c771260..9d5feafb17 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -549,7 +549,7 @@ watch(
redis_sentinel_password: config.redis_sentinel_password || "",
redis_sentinel_tls: config.redis_sentinel_tls || false,
redis_cluster_nodes: config.redis_cluster_nodes || "",
- redis_key_separator: config.redis_key_separator || ":",
+ redis_key_separator: config.redis_key_separator ?? ":",
etcd_endpoints: config.etcd_endpoints || "",
read_only: config.read_only || false,
visible_databases: config.visible_databases,
@@ -1095,7 +1095,7 @@ function connectionConfigForSubmit(id: string): ConnectionConfig {
config.redis_cluster_nodes = undefined;
}
if (config.db_type === "redis") {
- config.redis_key_separator = config.redis_key_separator?.trim() || ":";
+ config.redis_key_separator = config.redis_key_separator?.trim() ?? ":";
}
if (config.db_type === "etcd") {
config.etcd_endpoints = normalizeEndpointLines(config.etcd_endpoints || "");
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
index 20fcea0705..57bfa0aa41 100644
--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue
+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
@@ -104,7 +104,10 @@ const effectivePattern = computed(() => (searchMode.value === "key" ? redisKeySe
const isSearchMode = computed(() => (searchMode.value === "key" ? effectivePattern.value !== "*" : valueQuery.value !== ""));
const searchPlaceholder = computed(() => (searchMode.value === "key" ? (fuzzyKeySearch.value ? t("redis.fuzzyPattern") : t("redis.pattern")) : t("redis.valueSearchPlaceholder")));
const loadingEmptyText = computed(() => (searchMode.value === "value" && valueQuery.value ? t("redis.searchingValues") : t("redis.loadingKeys")));
-const redisKeySeparator = computed(() => connectionStore.getConfig(props.connectionId)?.redis_key_separator || ":");
+const redisKeySeparator = computed(() => connectionStore.getConfig(props.connectionId)?.redis_key_separator ?? ":");
+watch(redisKeySeparator, () => {
+ if (flatKeys.value.length > 0) rebuildTree(false);
+});
const lastTotalKeys = ref(0);
const fetchAllProgressText = computed(() => {
if (!isFetchingAll.value) return "";
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 60a4ad0f1c..6481868104 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -223,7 +223,7 @@
redisSentinelPassword: "哨兵密码",
redisSentinelTls: "哨兵 TLS",
redisSentinelTlsHint: "连接 Sentinel 节点时使用 TLS",
- redisKeySeparator: "键名命名空间分隔符",
+ redisKeySeparator: "键名分隔符(可选)",
etcdEndpoints: "Endpoints",
etcdEndpointsHint: "每行一个 endpoint。留空时使用上面的 host 和端口。",
etcdCaCertPlaceholder: "/path/to/ca.crt",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index f50f784110..53b084d515 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -220,7 +220,7 @@
redisSentinelPassword: "Sentinel 密碼",
redisSentinelTls: "Sentinel TLS",
redisSentinelTlsHint: "連線 Sentinel 節點時使用 TLS",
- redisKeySeparator: "鍵名命名空間分隔符",
+ redisKeySeparator: "鍵名分隔符(可選)",
searchDatabasePlaceholder: "搜尋資料庫類型",
iconView: "圖示檢視",
listView: "清單檢視",
diff --git a/apps/desktop/src/lib/redisKeyTree.ts b/apps/desktop/src/lib/redisKeyTree.ts
index 3eb3ec8017..37b24d2717 100644
--- a/apps/desktop/src/lib/redisKeyTree.ts
+++ b/apps/desktop/src/lib/redisKeyTree.ts
@@ -65,7 +65,7 @@ export function buildRedisKeyTree(keys: RedisKeyInfo[], db: number, separator =
}
function insertKeyIntoTree(root: RedisKeyTreeNode[], groupMap: Map<string, RedisKeyTreeGroupNode>, key: RedisKeyInfo, db: number, separator: string): void {
- const pathSegments = key.key_display.split(separator);
+ const pathSegments = separator ? key.key_display.split(separator) : [key.key_display];
if (pathSegments.length === 1) {
root.push({
kind: "leaf",