mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 08:23:34 +00:00
fix(i18n): translate backend error messages in connection failure toasts
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { computed, nextTick, onMounted, ref } from "vue";
|
||||
import { uuid } from "@/lib/utils";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { translateBackendError } from "@/i18n/backend-errors";
|
||||
import {
|
||||
ArrowUp,
|
||||
ArrowRightLeft,
|
||||
@@ -152,7 +153,7 @@ async function changeConnection(connectionId: string) {
|
||||
queryStore.updateDatabase(tab.id, database);
|
||||
}
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { translateBackendError } from "@/i18n/backend-errors";
|
||||
import { Upload, Download, RefreshCw } from "lucide-vue-next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
||||
@@ -34,7 +35,7 @@ async function refreshTree() {
|
||||
try {
|
||||
await connectionStore.refreshAllTree();
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { translateBackendError } from "@/i18n/backend-errors";
|
||||
import {
|
||||
Database,
|
||||
Table,
|
||||
@@ -304,7 +305,7 @@ async function toggle() {
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (!wasExpanded) node.isExpanded = false;
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +359,7 @@ async function openObjectBrowser() {
|
||||
await toggle();
|
||||
}
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +461,7 @@ async function newQuery() {
|
||||
const options = await getDatabaseOptions(node.connectionId);
|
||||
queryStore.createTab(node.connectionId, resolveDefaultDatabase(connection, options), undefined, "query");
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +489,7 @@ async function refresh() {
|
||||
try {
|
||||
await connectionStore.refreshTreeNode(props.node);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: e?.message || String(e) }), 5000);
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e?.message || String(e)) }), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user