mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 21:23:59 +00:00
diagram reference drawing
This commit is contained in:
@@ -57,7 +57,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFromDbInfo(db) {
|
function updateFromDbInfo(db = 'auto') {
|
||||||
|
if (db == 'auto' && dbInfo) db = $dbInfo;
|
||||||
if (!settings?.updateFromDbInfo || !db) return;
|
if (!settings?.updateFromDbInfo || !db) return;
|
||||||
|
|
||||||
onChange(current => {
|
onChange(current => {
|
||||||
@@ -301,7 +302,9 @@
|
|||||||
json.top = e.clientY - rect.top;
|
json.top = e.clientY - rect.top;
|
||||||
|
|
||||||
callChange(current => {
|
callChange(current => {
|
||||||
const foreignKeys = _.compact([
|
const foreignKeys = settings?.useDatabaseReferences
|
||||||
|
? []
|
||||||
|
: _.compact([
|
||||||
...(json.foreignKeys || []).map(fk => {
|
...(json.foreignKeys || []).map(fk => {
|
||||||
const tables = ((current || {}).tables || []).filter(
|
const tables = ((current || {}).tables || []).filter(
|
||||||
tbl => fk.refTableName == tbl.pureName && fk.refSchemaName == tbl.schemaName
|
tbl => fk.refTableName == tbl.pureName && fk.refSchemaName == tbl.schemaName
|
||||||
@@ -360,6 +363,7 @@
|
|||||||
: (current || {}).references,
|
: (current || {}).references,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
updateFromDbInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
function recomputeReferencePositions() {
|
function recomputeReferencePositions() {
|
||||||
@@ -383,6 +387,7 @@
|
|||||||
onChangeReference={changeReference}
|
onChangeReference={changeReference}
|
||||||
onRemoveReference={removeReference}
|
onRemoveReference={removeReference}
|
||||||
designer={value}
|
designer={value}
|
||||||
|
{settings}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
export let onChangeReference;
|
export let onChangeReference;
|
||||||
export let designer;
|
export let designer;
|
||||||
export let domTables;
|
export let domTables;
|
||||||
|
export let settings;
|
||||||
|
|
||||||
let src = null;
|
let src = null;
|
||||||
let dst = null;
|
let dst = null;
|
||||||
@@ -17,6 +18,9 @@
|
|||||||
|
|
||||||
const buswi = 10;
|
const buswi = 10;
|
||||||
const extwi = 25;
|
const extwi = 25;
|
||||||
|
const arwi = 12;
|
||||||
|
const arhi = 12;
|
||||||
|
const arpad = 3;
|
||||||
|
|
||||||
export function recomputePosition() {
|
export function recomputePosition() {
|
||||||
const { designerId, sourceId, targetId, columns, joinType } = reference;
|
const { designerId, sourceId, targetId, columns, joinType } = reference;
|
||||||
@@ -117,8 +121,18 @@
|
|||||||
`}
|
`}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
|
{#if settings?.showReferenceArrow}
|
||||||
|
<polygon
|
||||||
|
points={`
|
||||||
|
${dst.x - buswi * minpos.dirdst + arpad * minpos.dirdst},${dst.y}
|
||||||
|
${dst.x + arwi * minpos.dirdst - buswi * minpos.dirdst + arpad * minpos.dirdst},${dst.y + arhi / 2}
|
||||||
|
${dst.x + arwi * minpos.dirdst - buswi * minpos.dirdst + arpad * minpos.dirdst},${dst.y - arhi / 2}
|
||||||
|
`}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
|
{#if settings?.showJoinType}
|
||||||
<div
|
<div
|
||||||
use:contextMenu={createMenu}
|
use:contextMenu={createMenu}
|
||||||
class="wrapper"
|
class="wrapper"
|
||||||
@@ -132,6 +146,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg {
|
svg {
|
||||||
|
|||||||
@@ -11,5 +11,7 @@
|
|||||||
allowTableAlias: false,
|
allowTableAlias: false,
|
||||||
updateFromDbInfo: true,
|
updateFromDbInfo: true,
|
||||||
useDatabaseReferences: true,
|
useDatabaseReferences: true,
|
||||||
|
showJoinType: false,
|
||||||
|
showReferenceArrow: true,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,5 +11,7 @@
|
|||||||
allowTableAlias: true,
|
allowTableAlias: true,
|
||||||
updateFromDbInfo: false,
|
updateFromDbInfo: false,
|
||||||
useDatabaseReferences: false,
|
useDatabaseReferences: false,
|
||||||
|
showJoinType: true,
|
||||||
|
showReferenceArrow: false,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user