Browse Source

feat(nc-gui): Fixed mm table edge name bug

pull/3612/head
Muhammed Mustafa 2 years ago
parent
commit
1b07f0f7d5
  1. 2
      packages/nc-gui/components/erd/RelationEdge.vue
  2. 10
      packages/nc-gui/components/erd/SimpleView.vue

2
packages/nc-gui/components/erd/RelationEdge.vue

@ -112,7 +112,7 @@ export default {
/>
<EdgeText
v-if="label"
v-if="label?.length > 0"
:class="`nc-erd-table-label-${label.toLowerCase().replace(' ', '-').replace('\(', '').replace(')', '')}`"
:x="center[0]"
:y="center[1]"

10
packages/nc-gui/components/erd/SimpleView.vue

@ -100,7 +100,8 @@ const populateEdges = () => {
const source = column.fk_model_id!
const target = (column.colOptions as LinkToAnotherRecordType).fk_related_model_id!
let sourceColumnId, targetColumnId, edgeLabel
let sourceColumnId, targetColumnId
let edgeLabel = ''
if ((column.colOptions as LinkToAnotherRecordType).type === 'hm') {
sourceColumnId = (column.colOptions as LinkToAnotherRecordType).fk_child_column_id
@ -110,14 +111,15 @@ const populateEdges = () => {
if ((column.colOptions as LinkToAnotherRecordType).type === 'mm') {
sourceColumnId = (column.colOptions as LinkToAnotherRecordType).fk_parent_column_id
targetColumnId = (column.colOptions as LinkToAnotherRecordType).fk_child_column_id
edgeLabel =
config.showJunctionTableNames && edgeMMTableLabel((column.colOptions as LinkToAnotherRecordType).fk_mm_model_id!)
edgeLabel = config.showJunctionTableNames
? edgeMMTableLabel((column.colOptions as LinkToAnotherRecordType).fk_mm_model_id!)
: ''
}
if (source !== target) dagreGraph.setEdge(source, target)
return {
id: `e-${sourceColumnId}-${source}-${targetColumnId}-${target}`,
id: `e-${sourceColumnId}-${source}-${targetColumnId}-${target}-#${edgeLabel}`,
source: `${source}`,
target: `${target}`,
sourceHandle: `s-${sourceColumnId}-${source}`,

Loading…
Cancel
Save