mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-02 08:30:35 +00:00
feat: optimize connection error alerts
This commit is contained in:
@@ -42,6 +42,7 @@ import { useConnectionStore } from "@/stores/connectionStore";
|
||||
import { connectionIconType } from "@/lib/connectionPresentation";
|
||||
import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
|
||||
import { useQueryStore } from "@/stores/queryStore";
|
||||
import { useToast } from "@/composables/useToast";
|
||||
import { buildAiContext, runAiStream, type AiAction } from "@/lib/ai";
|
||||
import {
|
||||
aiTestConnection,
|
||||
@@ -59,6 +60,7 @@ const { t } = useI18n();
|
||||
const settings = useSettingsStore();
|
||||
const connectionStore = useConnectionStore();
|
||||
const queryStore = useQueryStore();
|
||||
const { toast } = useToast();
|
||||
|
||||
interface ChatMessage {
|
||||
role: "user" | "assistant";
|
||||
@@ -133,7 +135,7 @@ async function loadDatabases() {
|
||||
await loadDatabaseOptions(props.connection.id);
|
||||
}
|
||||
|
||||
function changeConnection(connectionId: string) {
|
||||
async function changeConnection(connectionId: string) {
|
||||
const conn = connectionStore.getConfig(connectionId);
|
||||
if (!conn) return;
|
||||
connectionStore.activeConnectionId = connectionId;
|
||||
@@ -143,6 +145,11 @@ function changeConnection(connectionId: string) {
|
||||
} else {
|
||||
queryStore.createTab(connectionId, conn.database || "");
|
||||
}
|
||||
try {
|
||||
await loadDatabaseOptions(connectionId);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
function changeDatabase(database: string) {
|
||||
|
||||
Reference in New Issue
Block a user