feat: add SSH config aliases and PostgreSQL extensions
This commit is contained in:
1 parent
8b035d0989
commit
f800d80f90
35 files changed
+1191
-33
No files matched your search
@@ -2660,6 +2660,18 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
schema: effectiveSchema,
|
||||
objectTypes: supportedSidebarObjectTypes(config),
|
||||
});
|
||||
if (isPostgresLikeForExtensions(config?.db_type)) {
|
||||
children.push({
|
||||
id: `${nodeId}:__extensions`,
|
||||
label: "tree.extensions",
|
||||
type: "group-extensions",
|
||||
connectionId,
|
||||
database,
|
||||
schema: effectiveSchema,
|
||||
isExpanded: false,
|
||||
children: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
if (isTreeLoadSearchChanged(searchFilter, options)) return;
|
||||
if (!canApplyTreeMetadataResult(node)) return;
|
||||
@@ -2795,6 +2807,35 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
);
|
||||
}
|
||||
|
||||
async function loadExtensions(connectionId: string, database: string, schema: string) {
|
||||
const node = findNode(treeNodes.value, `${connectionId}:${database}:${schema}:__extensions`);
|
||||
if (!node) return;
|
||||
node.isLoading = true;
|
||||
try {
|
||||
await ensureConnected(connectionId);
|
||||
if (useCachedChildren(node)) return;
|
||||
const extensions = await withMetadataLoadTimeout(connectionId, api.listExtensions(connectionId, database, schema), "extensions");
|
||||
const children: TreeNode[] = extensions.map((ext) => ({
|
||||
id: `${node.id}:${ext.name}`,
|
||||
label: ext.name,
|
||||
type: "extension" as const,
|
||||
connectionId,
|
||||
database,
|
||||
schema,
|
||||
comment: ext.comment ?? null,
|
||||
meta: ext,
|
||||
isExpanded: false,
|
||||
}));
|
||||
setChildren(node, children);
|
||||
node.isExpanded = true;
|
||||
} catch (e) {
|
||||
recordMetadataLoadError(connectionId, e);
|
||||
throw e;
|
||||
} finally {
|
||||
node.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMoreObjectGroupChildren(node: TreeNode) {
|
||||
if (node.type !== "load-more" || !node.loadMore) return;
|
||||
const loadMore = node.loadMore;
|
||||
@@ -3349,6 +3390,8 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
await loadObjectGroupChildren(node, options);
|
||||
} else if (node.type === "group-partitions") {
|
||||
node.isExpanded = true;
|
||||
} else if (node.type === "group-extensions" && node.connectionId && hasTreeNodeDatabaseContext(node)) {
|
||||
await loadExtensions(node.connectionId, node.database || "", node.schema || "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3412,6 +3455,10 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
return isSchemaAware(getConfig(connectionId)?.db_type);
|
||||
}
|
||||
|
||||
function isPostgresLikeForExtensions(dbType?: string): boolean {
|
||||
return dbType === "postgres" || dbType === "gaussdb" || dbType === "kwdb" || dbType === "opengauss" || dbType === "highgo" || dbType === "vastbase" || dbType === "kingbase";
|
||||
}
|
||||
|
||||
function metadataQuerySchema(connectionId: string, database: string, schema?: string): string {
|
||||
return connectionObjectTreeQuerySchema(getConfig(connectionId), database, schema);
|
||||
}
|
||||
|
||||
@@ -607,6 +607,13 @@ export const useQueryStore = defineStore("query", () => {
|
||||
if (legacy.rawTabs || legacy.rawActiveTabId) {
|
||||
const restored = restoreLegacySavedTabs();
|
||||
applyRestoredOpenTabs(restored);
|
||||
if (useSettingsStore().editorSettings.openTabsRestoreMode === "none") {
|
||||
// Restore is explicitly disabled, so keeping the legacy startup payload
|
||||
// would resurrect old tabs if the user later changes the setting.
|
||||
clearLegacySavedTabs();
|
||||
isOpenTabsLoaded.value = true;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await saveTabs(tabs.value, activeTabId.value);
|
||||
// Keep old desktop installs readable until the async store has the
|
||||
|
||||
Reference in new issue
Block a user