feat(sidebar): reveal local db file in OS file manager
This commit is contained in:
1 parent
6a87f31fdc
commit
d091b0db85
16 files changed
+265
-1
No files matched your search
@@ -23,6 +23,7 @@ import { applyParsedConnectionUrl, normalizeMongoConnectionString, parseConnecti
|
||||
import type { ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink";
|
||||
import { connectionUrlPlaceholder as getUrlPlaceholder } from "@/lib/connectionPresentation";
|
||||
import { h2ConnectionModeForConfig, h2FileJdbcUrl, h2FilePathFromJdbcUrl, type H2ConnectionMode } from "@/lib/h2Connection";
|
||||
import { isLocalFileTypeDb } from "@/lib/connectionFile";
|
||||
import { mongodbAuthFailureHint, mongoUrlParam, setMongoUrlParam } from "@/lib/mongoConnectionOptions";
|
||||
import { copyToClipboard } from "@/lib/clipboard";
|
||||
import { showAgentDriverInstallHint, type AgentDriverInstallState } from "@/lib/agentDriverInstallHint";
|
||||
@@ -847,7 +848,7 @@ const hasDbPickerResults = computed(() => filteredDbCategories.value.some((categ
|
||||
const selectedDbIcon = computed(() => iconTypeMap[selectedType.value] || selectedProfile().icon || selectedType.value);
|
||||
const isJdbcConnection = computed(() => form.value.db_type === "jdbc");
|
||||
const isH2FileMode = computed(() => form.value.db_type === "h2" && h2ConnectionMode.value === "file");
|
||||
const usesLocalFilePathInput = computed(() => form.value.db_type === "sqlite" || form.value.db_type === "duckdb" || form.value.db_type === "access" || isH2FileMode.value);
|
||||
const usesLocalFilePathInput = computed(() => isLocalFileTypeDb(form.value.db_type) && (form.value.db_type !== "h2" || isH2FileMode.value));
|
||||
|
||||
const connectionUrlPlaceholder = computed(() => getUrlPlaceholder(form.value.db_type));
|
||||
const filePathPlaceholder = computed(() => {
|
||||
|
||||
@@ -62,6 +62,8 @@ import { uuid } from "@/lib/utils";
|
||||
import { resolveDefaultDatabase } from "@/lib/defaultDatabase";
|
||||
import { canTreeNodeShowExpander, treeItemPaddingLeft, usesFullWidthTreeLabel } from "@/lib/sidebarTreeItemLayout";
|
||||
import { buildTableSelectSql } from "@/lib/tableSelectSql";
|
||||
import { connectionFilePath } from "@/lib/connectionFile";
|
||||
import { revealPathInFileManager } from "@/lib/tauri";
|
||||
import { clearActiveTableReferencePayload, createTableReferencePayload, createTableReferenceDropEvent, setActiveTableReferencePayload, type QueryEditorTableReferencePayload } from "@/lib/queryEditorTableDrop";
|
||||
import { editablePrimaryKeys, usesSyntheticRowIdKey } from "@/lib/tableEditing";
|
||||
import { supportsDatabaseCreation, supportsDatabaseSearch, supportsFieldLineage, supportsObjectBrowserTreeNode, supportsSchemaDiagram, supportsSqlFileExecution, supportsTableImport, supportsTableTruncate, supportsTableStructureEditing, usesTreeSchemaMode } from "@/lib/databaseCapabilities";
|
||||
@@ -2118,6 +2120,24 @@ function editConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
const revealConnectionFilePath = computed<string | null>(() => {
|
||||
if (props.node.type !== "connection" || !props.node.connectionId) return null;
|
||||
const config = connectionStore.getConfig(props.node.connectionId);
|
||||
if (!config) return null;
|
||||
return connectionFilePath(config);
|
||||
});
|
||||
|
||||
async function revealDatabaseFile() {
|
||||
const path = revealConnectionFilePath.value;
|
||||
if (!path) return;
|
||||
try {
|
||||
await revealPathInFileManager(path);
|
||||
} catch (e: any) {
|
||||
const message = typeof e === "string" ? e : e?.message || String(e);
|
||||
toast(message, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
async function disconnectConnection() {
|
||||
if (props.node.connectionId) {
|
||||
try {
|
||||
@@ -2713,6 +2733,13 @@ function treeItemMenuItems(): ContextMenuItem[] {
|
||||
});
|
||||
}
|
||||
items.push({ label: t("contextMenu.editConnection"), action: editConnection, icon: Pencil });
|
||||
if (revealConnectionFilePath.value) {
|
||||
items.push({
|
||||
label: t("contextMenu.revealDatabaseFile"),
|
||||
action: revealDatabaseFile,
|
||||
icon: FolderOpen,
|
||||
});
|
||||
}
|
||||
items.push({ label: t("contextMenu.duplicateConnection"), action: duplicateConnection, icon: CopyPlus });
|
||||
items.push({ label: "", separator: true });
|
||||
items.push({
|
||||
|
||||
Reference in new issue
Block a user