Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(grid): show query errors as alert instead of table row

t8y2fde76d5576ab
diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue
index 188deb73b2..83bdd7288d 100644
--- a/src/components/grid/DataGrid.vue
+++ b/src/components/grid/DataGrid.vue
@@ -27,6 +27,7 @@ import {
WrapText,
Info,
Rows3,
+ TriangleAlert,
} from "lucide-vue-next";
import { Button } from "@/components/ui/button";
import {
@@ -514,6 +515,10 @@ const emptyTitle = computed(() => (hasActiveFilter.value ? t("grid.noFilteredRow
const emptyDescription = computed(() =>
hasActiveFilter.value ? t("grid.noFilteredRowsDescription") : t("grid.noRowsDescription"),
);
+const isErrorResult = computed(
+ () => props.result.columns.length === 1 && props.result.columns[0] === "Error" && props.result.rows.length > 0,
+);
+const errorMessage = computed(() => (isErrorResult.value ? String(props.result.rows[0]?.[0] ?? "") : ""));
const selectedRange = computed<CellSelectionRange | null>(() => {
if (!selectionAnchor.value || !selectionFocus.value) return null;
return normalizeSelectionRange(selectionAnchor.value, selectionFocus.value);
@@ -1340,7 +1345,18 @@ function escapeAndHighlightKeywords(s: string): string {
</div>
<div
- v-if="!hasVisibleRows"
+ v-if="isErrorResult"
+ class="flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center text-destructive"
+ >
+ <TriangleAlert class="h-8 w-8 text-destructive/50" aria-hidden="true" />
+ <div class="space-y-1">
+ <div class="text-sm font-medium">{{ t("grid.queryError") }}</div>
+ <div class="text-xs max-w-lg break-all text-destructive/80">{{ errorMessage }}</div>
+ </div>
+ </div>
+
+ <div
+ v-else-if="!hasVisibleRows"
class="flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center text-muted-foreground"
>
<component
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts
index 7d8be42a56..9b5b03b0d6 100644
--- a/src/i18n/locales/en.ts
+++ b/src/i18n/locales/en.ts
@@ -216,6 +216,7 @@ export default {
transpose: "Transpose Row",
rowsPerPageShort: " rows",
columnDetails: "Column Details",
+ queryError: "Query Error",
},
welcome: {
title: "Database Workspace",
diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts
index fc8bc974f1..bf28f329c9 100644
--- a/src/i18n/locales/zh-CN.ts
+++ b/src/i18n/locales/zh-CN.ts
@@ -215,6 +215,7 @@ export default {
transpose: "转置查看",
rowsPerPageShort: " 行/页",
columnDetails: "列详情",
+ queryError: "查询出错",
},
welcome: {
title: "数据库工作台",