feat(xugu): show tablespace details in sidebar
This commit is contained in:
1 parent
2f4a72c4e9
commit
7e24f4007c
12 files changed
+305
-1
No files matched your search
@@ -91,6 +91,7 @@ import { ensureSqlExtension, stripSqlExtension } from "@/lib/savedSql/savedSqlFi
|
||||
import { savedSqlErrorMessage } from "@/lib/savedSql/savedSqlErrors";
|
||||
import { useSavedSqlStore } from "@/stores/savedSqlStore";
|
||||
import { isXuguPublicSynonymTreeNode, isXuguSchedulerJobTreeNode, xuguSchemaDisplayName } from "@/lib/sidebar/xuguPublicSynonyms";
|
||||
import { xuguDatafileDetailRows, xuguTablespaceDetailRows } from "@/lib/sidebar/xuguTablespaces";
|
||||
// --- Drag and Drop ---
|
||||
import { useDragSort } from "@/composables/useDragSort";
|
||||
import { sidebarTreeRuntimeKey } from "@/lib/sidebar/sidebarTreeRuntime";
|
||||
@@ -478,6 +479,22 @@ function cleanTooltipValue(value: string | number | null | undefined): string {
|
||||
return String(value ?? "").trim();
|
||||
}
|
||||
|
||||
function formatXuguStorageDetailValue(key: string, value: string): string {
|
||||
if (key === "currentSize" || key === "maxSize" || key === "stepSize") {
|
||||
const numeric = Number(value);
|
||||
if (Number.isFinite(numeric)) {
|
||||
if (key === "maxSize" && numeric === -1) return t("tree.xuguStorage.unlimited");
|
||||
return `${numeric} MB`;
|
||||
}
|
||||
}
|
||||
if (key === "mediaError") {
|
||||
const normalized = value.toUpperCase();
|
||||
if (["F", "FALSE", "0", "N"].includes(normalized)) return t("tree.xuguStorage.no");
|
||||
if (["T", "TRUE", "1", "Y"].includes(normalized)) return t("tree.xuguStorage.yes");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function isLocalFileConnection(config: Pick<ConnectionConfig, "db_type" | "port">): boolean {
|
||||
return config.db_type === "sqlite" || config.db_type === "duckdb" || config.db_type === "access" || (config.db_type === "h2" && config.port === 0);
|
||||
}
|
||||
@@ -571,6 +588,22 @@ const detailTooltip = computed(() => {
|
||||
].filter((row) => row.value);
|
||||
return rows.length ? { rows } : null;
|
||||
}
|
||||
if (node.type === "tablespace" && node.xuguTablespace && node.connectionId && effectiveDatabaseTypeForConnection(connectionStore.getConfig(node.connectionId)) === "xugu") {
|
||||
const rows: DetailTooltipRow[] = xuguTablespaceDetailRows(node.xuguTablespace).map((row) => ({
|
||||
label: t(`tree.xuguStorage.${row.key}`),
|
||||
value: formatXuguStorageDetailValue(row.key, row.value),
|
||||
multiline: row.multiline,
|
||||
}));
|
||||
return rows.length ? { rows } : null;
|
||||
}
|
||||
if (node.type === "datafile" && node.xuguDatafile && node.connectionId && effectiveDatabaseTypeForConnection(connectionStore.getConfig(node.connectionId)) === "xugu") {
|
||||
const rows: DetailTooltipRow[] = xuguDatafileDetailRows(node.xuguDatafile).map((row) => ({
|
||||
label: t(`tree.xuguStorage.${row.key}`),
|
||||
value: formatXuguStorageDetailValue(row.key, row.value),
|
||||
multiline: row.multiline,
|
||||
}));
|
||||
return rows.length ? { rows } : null;
|
||||
}
|
||||
const comment = node.type === "column" && node.meta && "comment" in node.meta ? (node.meta as ColumnInfo).comment : node.comment;
|
||||
if (!comment || (node.type !== "schema" && node.type !== "table" && node.type !== "view" && node.type !== "column")) return null;
|
||||
const rows: DetailTooltipRow[] = [
|
||||
|
||||
Reference in new issue
Block a user