From 0ee27e716c84399639281b492fe842dd92a07555 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 12 Jul 2024 18:22:01 +0000 Subject: [PATCH] feat: relation across bases --- .../nc-gui/components/smartsheet/Cell.vue | 2 +- .../components/smartsheet/PlainCell.vue | 17 +- .../smartsheet/column/LinkAdvancedOptions.vue | 86 +++++++-- .../smartsheet/toolbar/FilterInput.vue | 2 +- packages/nocodb/src/db/BaseModelSqlv2.ts | 175 +++++++++++++----- packages/nocodb/src/db/genRollupSelectv2.ts | 33 +++- .../nocodb/src/services/columns.service.ts | 12 +- packages/nocodb/tsconfig.json | 1 - 8 files changed, 234 insertions(+), 94 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue index bf86025452..50d7768f0a 100644 --- a/packages/nc-gui/components/smartsheet/Cell.vue +++ b/packages/nc-gui/components/smartsheet/Cell.vue @@ -51,7 +51,7 @@ const { currentRow } = useSmartsheetRowStoreOrThrow() const { sqlUis } = storeToRefs(useBase()) -const sqlUi = ref(column.value?.source_id ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0]) +const sqlUi = ref(column.value?.source_id && sqlUis.value[column.value?.source_id] ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0]) const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value)) diff --git a/packages/nc-gui/components/smartsheet/PlainCell.vue b/packages/nc-gui/components/smartsheet/PlainCell.vue index 3c348da80f..45686e226a 100644 --- a/packages/nc-gui/components/smartsheet/PlainCell.vue +++ b/packages/nc-gui/components/smartsheet/PlainCell.vue @@ -37,7 +37,9 @@ const { basesUser } = storeToRefs(basesStore) const { isXcdbBase, isMssql, isMysql } = useBase() -const sqlUi = ref(column.value?.source_id ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0]) +const { getPossibleAttachmentSrc } = useAttachment() + +const sqlUi = ref(column.value?.source_id && sqlUis.value[column.value?.source_id] ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0]) const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value)) @@ -246,7 +248,7 @@ const getLookupValue = (modelValue: string | null | number | Array, col: Co const getAttachmentValue = (modelValue: string | null | number | Array) => { if (Array.isArray(modelValue)) { - return modelValue.map((v) => `${v.title}`).join(', ') + return modelValue.map((v) => `${v.title} (${getPossibleAttachmentSrc(v).join(', ')})`).join(', ') } return modelValue as string } @@ -341,20 +343,20 @@ const parseValue = (value: any, col: ColumnType): string => { diff --git a/packages/nc-gui/components/smartsheet/column/LinkAdvancedOptions.vue b/packages/nc-gui/components/smartsheet/column/LinkAdvancedOptions.vue index 879a6dd3a5..f4d1e1401e 100644 --- a/packages/nc-gui/components/smartsheet/column/LinkAdvancedOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/LinkAdvancedOptions.vue @@ -1,14 +1,15 @@