diff --git a/packages/web/src/designer/DesignerTable.svelte b/packages/web/src/designer/DesignerTable.svelte
index d0204ebc..ac74e0c9 100644
--- a/packages/web/src/designer/DesignerTable.svelte
+++ b/packages/web/src/designer/DesignerTable.svelte
@@ -65,6 +65,8 @@
$: left = table?.left;
$: top = table?.top;
$: mainIcon = settings?.getMainTableIcon ? settings?.getMainTableIcon(designerId) : null;
+ $: specificDb = settings?.tableSpecificDb ? settings?.tableSpecificDb(designerId) : null;
+
export function isSelected() {
return table?.isSelectedTable;
}
@@ -254,6 +256,10 @@
{/if}
{alias || pureName}
+
+ {#if specificDb}
+
+ {/if}
{#if settings?.showTableCloseButton}
onRemoveTable(table)}>
diff --git a/packages/web/src/perspectives/PerspectiveDesigner.svelte b/packages/web/src/perspectives/PerspectiveDesigner.svelte
index a84f52f2..3a9b6390 100644
--- a/packages/web/src/perspectives/PerspectiveDesigner.svelte
+++ b/packages/web/src/perspectives/PerspectiveDesigner.svelte
@@ -13,6 +13,7 @@
import Designer from '../designer/Designer.svelte';
import QueryDesignerReference from '../designer/QueryDesignerReference.svelte';
+ import { currentDatabase } from '../stores';
import { getPerspectiveNodeMenu } from './perspectiveMenu';
export let config: PerspectiveConfig;
@@ -100,6 +101,12 @@
const newNode = createPerspectiveNodeConfig(table);
newNode.designerId = table.designerId;
newNode.position = { x: table.left, y: table.top };
+ if ($currentDatabase?.name != database) {
+ newNode.database = $currentDatabase?.name;
+ }
+ if ($currentDatabase?.connection?._id != conid) {
+ newNode.conid = $currentDatabase?.connection?._id;
+ }
isArranged = false;
res.nodes.push(newNode);
}
@@ -248,6 +255,15 @@
const child = node?.childNodes?.find(x => x.columnName == columnName);
child?.toggleCheckedNode(true);
},
+ tableSpecificDb: designerId => {
+ const node = config.nodes.find(x => x.designerId == designerId);
+ if (node?.conid || node?.database) {
+ return {
+ conid: node.conid,
+ database: node.database,
+ };
+ }
+ },
}}
referenceComponent={QueryDesignerReference}
value={createDesignerModel(config, dbInfos)}
diff --git a/packages/web/src/perspectives/PerspectiveView.svelte b/packages/web/src/perspectives/PerspectiveView.svelte
index d3b00d89..5ee0a2b2 100644
--- a/packages/web/src/perspectives/PerspectiveView.svelte
+++ b/packages/web/src/perspectives/PerspectiveView.svelte
@@ -125,10 +125,11 @@
let perspectiveDatabases = extractPerspectiveDatabases({ conid, database }, config);
$: {
const newDatabases = extractPerspectiveDatabases({ conid, database }, config);
- if (stableStringify(newDatabases) != stableStringify(newDatabases)) {
+ if (stableStringify(newDatabases) != stableStringify(perspectiveDatabases)) {
perspectiveDatabases = newDatabases;
}
}
+
$: dbInfos = useMultipleDatabaseInfo(perspectiveDatabases);
$: rootObject = config?.nodes?.find(x => x.designerId == config?.rootDesignerId);
$: tableInfo = useTableInfo({ conid, database, ...rootObject });