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 <EdgeText
v-if="label" v-if="label?.length > 0"
:class="`nc-erd-table-label-${label.toLowerCase().replace(' ', '-').replace('\(', '').replace(')', '')}`" :class="`nc-erd-table-label-${label.toLowerCase().replace(' ', '-').replace('\(', '').replace(')', '')}`"
:x="center[0]" :x="center[0]"
:y="center[1]" :y="center[1]"

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

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

Loading…
Cancel
Save