From 93582df14ae398078b28fdca3fa68cf5bfa82eee Mon Sep 17 00:00:00 2001 From: zipg Date: Tue, 30 Jun 2026 17:36:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9F=A5=E8=AF=A2=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=A1=B5=E6=94=AF=E6=8C=81=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/desktop/src/App.vue | 16 +++++++++++++++- .../components/connection/ConnectionDialog.vue | 9 +++++++-- .../desktop/src/components/layout/AppDialogs.vue | 3 +++ .../src/components/layout/ContentArea.vue | 10 ++++++++++ apps/desktop/src/i18n/locales/en.ts | 1 + apps/desktop/src/i18n/locales/zh-CN.ts | 1 + 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 46fc5da13..13c16ed9d 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -12,6 +12,7 @@ import ContentArea from "@/components/layout/ContentArea.vue"; import AppDialogs from "@/components/layout/AppDialogs.vue"; import WelcomeScreen from "@/components/layout/WelcomeScreen.vue"; import DdlViewDialog from "@/components/objects/DdlViewDialog.vue"; +import type { ConfigTab } from "@/components/connection/ConnectionDialog.vue"; import { useConnectionStore } from "@/stores/connectionStore"; import { useQueryStore } from "@/stores/queryStore"; import { useSettingsStore } from "@/stores/settingsStore"; @@ -115,6 +116,7 @@ const setupRequired = ref(false); const showConnectionDialog = ref(false); const connectionDialogPrefill = ref(null); +const connectionDialogInitialTab = ref(undefined); const showSettingsDialog = ref(false); const settingsInitialTab = ref("editor"); const settingsInitialSection = ref(undefined); @@ -798,7 +800,17 @@ async function openPendingConnectionLinks() { function setConnectionDialogOpen(value: boolean) { showConnectionDialog.value = value; - if (!value) connectionDialogPrefill.value = null; + if (!value) { + connectionDialogPrefill.value = null; + connectionDialogInitialTab.value = undefined; + } +} + +function openConnectionSettings(connectionId: string, initialTab: ConfigTab = "connection") { + if (!connectionStore.getConfig(connectionId)) return; + connectionDialogInitialTab.value = initialTab; + connectionStore.startEditing(connectionId); + showConnectionDialog.value = true; } async function newQuery() { @@ -1638,6 +1650,7 @@ onUnmounted(() => { " @structure-editor-close="activeTab && queryStore.closeTab(activeTab.id)" @open-settings="openSettings" + @open-connection-settings="openConnectionSettings" /> @@ -1683,6 +1696,7 @@ onUnmounted(() => { (); const emit = defineEmits<{ @@ -125,6 +126,10 @@ const visibleSchemaInitialSelection = ref([]); const visibleSchemaError = ref(""); let testRunId = 0; +function initialConfigTab(): ConfigTab { + return props.initialTab ?? "connection"; +} + const defaultForm = (): ConnectionForm => ({ name: "", db_type: "mysql", @@ -1165,7 +1170,7 @@ watch( jdbcManualClasspathOpen.value = config.db_type === "prestosql" || (config.jdbc_driver_paths || []).length > 0; customDriverName.value = isCustomCompatibleProfile() ? config.driver_label || "" : ""; dialogStep.value = "config"; - configTab.value = "connection"; + configTab.value = initialConfigTab(); } else { editingId.value = null; form.value = defaultForm(); diff --git a/apps/desktop/src/components/layout/AppDialogs.vue b/apps/desktop/src/components/layout/AppDialogs.vue index 1ce454ed6..3f7250d45 100644 --- a/apps/desktop/src/components/layout/AppDialogs.vue +++ b/apps/desktop/src/components/layout/AppDialogs.vue @@ -21,10 +21,12 @@ const DataGenerateDialog = defineAsyncComponent(() => import("@/components/gener import { useConnectionStore } from "@/stores/connectionStore"; import { useDialogSources } from "@/composables/useDialogSources"; import type { ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink"; +import type { ConfigTab } from "@/components/connection/ConnectionDialog.vue"; const props = defineProps<{ showConnectionDialog: boolean; connectionPrefill?: ConnectionDeepLinkDraft | null; + connectionInitialTab?: ConfigTab; showSettingsDialog: boolean; settingsInitialTab?: string; settingsInitialSection?: string; @@ -108,6 +110,7 @@ watch( :open="shouldShowConnectionDialog" :edit-config="editConfig" :prefill-config="connectionPrefill" + :initial-tab="connectionInitialTab" @update:open="emit('update:showConnectionDialog', $event)" @connect-started="emit('connectStarted', $event)" @connect-succeeded="emit('connectSucceeded', $event)" diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue index 7c18f640d..ca9254acd 100644 --- a/apps/desktop/src/components/layout/ContentArea.vue +++ b/apps/desktop/src/components/layout/ContentArea.vue @@ -137,6 +137,7 @@ const emit = defineEmits<{ structureEditorSaved: [commentChanged: boolean]; structureEditorClose: []; openSettings: [initialTab?: string, initialSection?: string]; + openConnectionSettings: [connectionId: string, initialTab: "advanced"]; }>(); const { t } = useI18n(); @@ -178,6 +179,11 @@ const dataGridRenderMode = computed(() => settingsStore.editorSettings.dataGridR const tableFontSize = computed(() => settingsStore.editorSettings.tableFontSize); const dataGridViewOptionsActive = computed(() => dataGridRef.value?.nullColumnsHidden || dataGridRef.value?.multiRowTranspose || dataGridRenderMode.value === "dom" || tableFontSize.value !== TABLE_FONT_SIZE_DEFAULT); const redisKeyBrowserRef = ref(); + +function isQueryTimeoutError(message: string): boolean { + const lower = message.toLowerCase(); + return lower.includes("query timed out") || lower.includes("查询超时"); +} const etcdKeyBrowserRef = ref(); const zookeeperKeyBrowserRef = ref(); const objectBrowserRef = ref(); @@ -977,6 +983,10 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExe @sort="(column: string, columnIndex: number, direction: 'asc' | 'desc' | null, whereInput?: string, mode?: DataGridSortMode) => emit('sort', column, columnIndex, direction, whereInput, mode)" >