From 154aec8922754a2e2973de232091931eaaa5959c Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Wed, 4 Oct 2023 06:16:19 +0000 Subject: [PATCH 1/4] fix(nc-gui): Added relation modal for base/source node in sidebar --- .../dashboard/TreeView/ProjectNode.vue | 25 +++++++++---------- packages/nc-gui/components/dlg/ProjectErd.vue | 20 +++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 packages/nc-gui/components/dlg/ProjectErd.vue diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue index b135802c3f..bfbe544c0a 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue @@ -289,22 +289,21 @@ const onProjectClick = async (base: NcProject, ignoreNavigation?: boolean, toggl } function openErdView(source: SourceType) { - activeBaseId.value = source.id - isErdModalOpen.value = !isErdModalOpen.value -} + $e('c:project:relation') -async function openProjectErdView(_project: BaseType) { - if (!_project.id) return + const isOpen = ref(true) - if (!basesStore.isProjectPopulated(_project.id)) { - await loadProject(_project.id) - } + const { close } = useDialog(resolveComponent('DlgProjectErd'), { + 'modelValue': isOpen, + 'sourceId': source!.id, + 'onUpdate:modelValue': () => closeDialog(), + }) - const base = bases.value.get(_project.id) + function closeDialog() { + isOpen.value = false - const source = base?.sources?.[0] - if (!source) return - openErdView(source) + close(1000) + } } const reloadTables = async () => { @@ -545,7 +544,7 @@ const projectDelete = () => { key="erd" v-e="['c:base:erd']" data-testid="nc-sidebar-base-relations" - @click="openProjectErdView(base)" + @click="openErdView(base?.sources?.[0]!)" > {{ $t('title.relations') }} diff --git a/packages/nc-gui/components/dlg/ProjectErd.vue b/packages/nc-gui/components/dlg/ProjectErd.vue new file mode 100644 index 0000000000..03dde3144e --- /dev/null +++ b/packages/nc-gui/components/dlg/ProjectErd.vue @@ -0,0 +1,20 @@ + + + From 18ed49ab4f6d49eb2df1c3faa0ebbb85fbb32ad1 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Wed, 4 Oct 2023 06:16:19 +0000 Subject: [PATCH 2/4] fix(nc-gui): Hide MM system column in ERD view --- packages/nc-gui/components/erd/TableNode.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/erd/TableNode.vue b/packages/nc-gui/components/erd/TableNode.vue index 8859a0b40c..6df4f85978 100644 --- a/packages/nc-gui/components/erd/TableNode.vue +++ b/packages/nc-gui/components/erd/TableNode.vue @@ -29,12 +29,28 @@ const relatedColumnId = (colOptions: LinkToAnotherRecordType | any) => const hasColumns = computed(() => data.pkAndFkColumns.length || data.nonPkColumns.length) +const nonPkColumns = computed(() => + data.nonPkColumns + // Removed MM system column from the table node + .filter((col) => !(col.system && isLinksOrLTAR(col))), +) + watch( () => viewport.value.zoom, () => { isZooming.value = true }, ) + +watch( + () => data, + () => { + console.log('data changed', data) + }, + { + immediate: true, + }, +)