feat: 查询超时错误页支持跳转修改超时时间

This commit is contained in:
zipg authored and GitHub committed 2026-06-30 17:36:44 +08:00
1 parent cb8989153a
commit 93582df14a
6 files changed
+37 -3

No files matched your search

@@ -48,7 +48,7 @@ type DbOption = { value: string; label: string };
type DbCategory = { key: string; title: string; options: DbOption[] };
type DialogStep = "select" | "config";
type DbPickerView = "icon" | "list";
type ConfigTab = "connection" | "advanced" | "tls" | "transport";
export type ConfigTab = "connection" | "advanced" | "tls" | "transport";
type MqTokenSigningMode = "none" | "hs256" | "rs256";
type NacosAuthKind = NacosAuthConfig["kind"];
type DremioConnectionMode = "arrow-flight-sql" | "legacy";
@@ -97,6 +97,7 @@ const isDesktop = isTauriRuntime();
const props = defineProps<{
editConfig?: ConnectionConfig;
prefillConfig?: ConnectionDeepLinkDraft | null;
initialTab?: ConfigTab;
}>();
const emit = defineEmits<{
@@ -125,6 +126,10 @@ const visibleSchemaInitialSelection = ref<string[]>([]);
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();
@@ -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)"
@@ -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<SearchableBrowserHandle>();
function isQueryTimeoutError(message: string): boolean {
const lower = message.toLowerCase();
return lower.includes("query timed out") || lower.includes("查询超时");
}
const etcdKeyBrowserRef = ref<SearchableBrowserHandle>();
const zookeeperKeyBrowserRef = ref<SearchableBrowserHandle>();
const objectBrowserRef = ref<SearchableBrowserHandle>();
@@ -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)"
>
<template v-if="activeTab.result?.columns.includes('Error')" #error-actions="{ errorMessage }">
<Button v-if="activeTab.connectionId && isQueryTimeoutError(String(errorMessage))" variant="outline" size="sm" class="h-7 gap-1.5 px-2.5 text-xs" @click="emit('openConnectionSettings', activeTab.connectionId, 'advanced')">
<Wrench class="h-3.5 w-3.5" />
{{ t("editor.changeQueryTimeout") }}
</Button>
<Button variant="outline" size="sm" class="h-7 gap-1.5 px-2.5 text-xs" @click="emit('fixWithAi', String(errorMessage))">
<Bot class="h-3.5 w-3.5" />
{{ t("ai.fixWithAi") }}