From 7de0de2313993206a31b4b72e33a62a4a02ce575 Mon Sep 17 00:00:00 2001 From: haipengno1 Date: Fri, 12 Jun 2026 00:18:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20Redis=20=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/desktop/src/App.vue | 5 +++ .../src/components/editor/QueryEditor.vue | 2 +- .../src/components/layout/EditorToolbar.vue | 24 +++++++++++- .../src/composables/useSqlExecution.ts | 21 +++++++++- apps/desktop/src/i18n/locales/en.ts | 2 + apps/desktop/src/i18n/locales/es.ts | 2 + apps/desktop/src/i18n/locales/it.ts | 2 + apps/desktop/src/i18n/locales/pt-BR.ts | 2 + apps/desktop/src/i18n/locales/zh-CN.ts | 2 + apps/desktop/src/i18n/locales/zh-TW.ts | 2 + apps/desktop/src/lib/http.ts | 4 +- apps/desktop/src/lib/redisQueryResult.ts | 38 +++++++++++++++++++ .../desktop/src/lib/sqlSemanticDiagnostics.ts | 2 +- apps/desktop/src/lib/tauri.ts | 4 +- apps/desktop/src/stores/queryStore.ts | 30 ++++++++++++++- crates/dbx-core/src/db/redis_driver.rs | 10 ++++- crates/dbx-core/src/redis_ops.rs | 5 ++- crates/dbx-web/src/routes/redis.rs | 13 +++++-- src-tauri/src/commands/redis_cmd.rs | 10 ++++- 19 files changed, 160 insertions(+), 20 deletions(-) create mode 100644 apps/desktop/src/lib/redisQueryResult.ts diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 7589553ca9..33dc49896c 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -185,12 +185,15 @@ async function resolveActiveExecutableSql() { : ""; } +const blockDangerousRedisCommands = ref(true); + const { dangerSql, pendingDangerSql, showDangerDialog, suppressDangerConfirm, tryExecute, doExecute, cancelActiveExecution, tryExplain, onDangerConfirm, explainMode } = useSqlExecution({ activeTab, activeConnection, executableSql, resolveExecutableSql: resolveActiveExecutableSql, activeOutputView, + blockDangerousRedisCommands, }); const dialogs = useDialogSources(); @@ -1062,7 +1065,9 @@ onUnmounted(() => { :active-connection="activeConnection" :executable-sql="executableSql" :explain-mode="explainMode" + :block-dangerous-redis-commands="blockDangerousRedisCommands" @update:explain-mode="(m: 'explain' | 'autotrace') => (explainMode = m)" + @update:block-dangerous-redis-commands="(v: boolean) => (blockDangerousRedisCommands = v)" @execute="tryExecute()" @cancel="cancelActiveExecution()" @explain="tryExplain()" diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue index 343937f17c..1f52ac3d8a 100644 --- a/apps/desktop/src/components/editor/QueryEditor.vue +++ b/apps/desktop/src/components/editor/QueryEditor.vue @@ -684,7 +684,7 @@ async function refreshSemanticDiagnostics() { setSemanticDiagnostics([]); return; } - if (props.databaseType === "mongodb" || props.databaseType === "elasticsearch") { + if (props.databaseType === "mongodb" || props.databaseType === "elasticsearch" || props.databaseType === "redis") { setSemanticDiagnostics([]); return; } diff --git a/apps/desktop/src/components/layout/EditorToolbar.vue b/apps/desktop/src/components/layout/EditorToolbar.vue index 8d8482629b..924c324641 100644 --- a/apps/desktop/src/components/layout/EditorToolbar.vue +++ b/apps/desktop/src/components/layout/EditorToolbar.vue @@ -1,7 +1,7 @@