|
|
@ -23,8 +23,6 @@ const edges = ref<Edge[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
let isLoading = $ref(true) |
|
|
|
let isLoading = $ref(true) |
|
|
|
|
|
|
|
|
|
|
|
const isLayouting = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const config = ref({ |
|
|
|
const config = ref({ |
|
|
|
showPkAndFk: true, |
|
|
|
showPkAndFk: true, |
|
|
|
showViews: false, |
|
|
|
showViews: false, |
|
|
@ -41,7 +39,9 @@ const loadMetasOfTablesNotInMetas = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const populateTables = () => { |
|
|
|
const populateTables = () => { |
|
|
|
tables.value.forEach((table) => { |
|
|
|
tables.value |
|
|
|
|
|
|
|
.filter((table) => (!config.value.showViews && table.type !== 'view') || config.value.showViews) |
|
|
|
|
|
|
|
.forEach((table) => { |
|
|
|
if (!table.id) return |
|
|
|
if (!table.id) return |
|
|
|
|
|
|
|
|
|
|
|
dagreGraph.setNode(table.id, { width: 250, height: 30 * metasWithId.value[table.id].columns.length }) |
|
|
|
dagreGraph.setNode(table.id, { width: 250, height: 30 * metasWithId.value[table.id].columns.length }) |
|
|
@ -125,8 +125,6 @@ const resetElements = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const populateErd = (shouldReset = false) => { |
|
|
|
const populateErd = (shouldReset = false) => { |
|
|
|
isLayouting.value = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shouldReset) { |
|
|
|
if (shouldReset) { |
|
|
|
dagreGraph = new dagre.graphlib.Graph() |
|
|
|
dagreGraph = new dagre.graphlib.Graph() |
|
|
|
dagreGraph.setDefaultEdgeLabel(() => ({})) |
|
|
|
dagreGraph.setDefaultEdgeLabel(() => ({})) |
|
|
@ -137,8 +135,8 @@ const populateErd = (shouldReset = false) => { |
|
|
|
populateElements() |
|
|
|
populateElements() |
|
|
|
populateRelations() |
|
|
|
populateRelations() |
|
|
|
layoutNodes() |
|
|
|
layoutNodes() |
|
|
|
|
|
|
|
console.log('nodes', nodes.value) |
|
|
|
isLayouting.value = false |
|
|
|
console.log('edges', edges.value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onBeforeMount(async () => { |
|
|
|
onBeforeMount(async () => { |
|
|
|