π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
disable related field links
Ramesh Maned3910590fae0
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue b/packages/nc-gui/components/smartsheet/expanded-form/Detached.vueindex 6436351302..950b136dff 100644--- a/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue+++ b/packages/nc-gui/components/smartsheet/expanded-form/Detached.vue@@ -24,6 +24,7 @@ const shouldClose = (isVisible: boolean, i: number) => {:blueprint-mode="state.blueprintMode":existing-template-names="state.existingTemplateNames":editing-template-id="state.editingTemplateId"+ :blueprint-parent-table-id="state.blueprintParentTableId":new-record-submit-btn-text="state.newRecordSubmitBtnText":new-record-header="state.newRecordHeader"@update:model-value="shouldClose($event, i)"diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vueindex 134ac3a475..bab06b1ff8 100644--- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue+++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue@@ -26,6 +26,7 @@ interface Props {blueprintMode?: booleanexistingTemplateNames?: string[]editingTemplateId?: string+ blueprintParentTableId?: stringexpandForm?: (row: Row) => voidmaintainDefaultViewOrder?: booleanallowNullFieldIds?: string[]@@ -116,6 +117,8 @@ provide(MetaInj, activeMeta)provide(IsTemplateModeInj, computed(() => !!props.templateMode || !!props.blueprintMode))+provide(BlueprintParentTableIdInj, computed(() => props.blueprintParentTableId))+// override cell event hook to avoid unexpected behavior at form fields// issue happens when opening expanded form from cell (LTAR/Links)provide(CanvasSelectCellInj, undefined)diff --git a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Fields/ColumnList.vue b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Fields/ColumnList.vueindex 4437b28dfe..275ccd8912 100644--- a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Fields/ColumnList.vue+++ b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Fields/ColumnList.vue@@ -19,6 +19,8 @@ const meta = inject(MetaInj, ref())const isTemplateMode = inject(IsTemplateModeInj, ref(false))+const blueprintParentTableId = inject(BlueprintParentTableIdInj, ref())+const { isUIAllowed } = useRoles()const { isMobileMode } = useGlobal()@@ -29,6 +31,12 @@ const { open: openExpandedFormDetached } = useExpandedFormDetached()const readOnly = computed(() => !isUIAllowed('dataEdit') || isPublic.value || isSqlView.value)+const isParentLtarColumn = (col: ColumnType): boolean => {+ if (!blueprintParentTableId.value || !isLinksOrLTAR(col)) return false+ const colOptions = col.colOptions as LinkToAnotherRecordType+ return colOptions?.fk_related_model_id === blueprintParentTableId.value+}+const addBlueprintForColumn = async (col: ColumnType) => {const colOptions = col.colOptions as LinkToAnotherRecordTypeconst relatedTableId = colOptions?.fk_related_model_id@@ -46,6 +54,7 @@ const addBlueprintForColumn = async (col: ColumnType) => {loadRow: false,useMetaFields: true,blueprintMode: true,+ blueprintParentTableId: meta.value?.id,newRecordSubmitBtnText: 'Save Blueprint',newRecordHeader: `New ${relatedMeta.title} (Blueprint)`,createdRecord: (record: Record<string, any>) => {@@ -157,10 +166,12 @@ const isSyncedColumn = (column: ColumnType) => meta.value?.synced && column?.rea'lg:max-w-[calc(100%_-_188px)]': !props.forceVerticalMode,}":placement="isMobileMode ? 'top' : 'right'"- :disabled="!showReadonlyColumnTooltip(col)"+ :disabled="!showReadonlyColumnTooltip(col) && !isParentLtarColumn(col)":arrow="false">- <template #title>{{ $t('msg.info.fieldReadonly') }}</template>+ <template #title>{{+ isParentLtarColumn(col) ? 'This field will be auto-linked to the parent record' : $t('msg.info.fieldReadonly')+ }}</template><PermissionsTooltipv-if="col.title"class="w-full"@@ -179,7 +190,7 @@ const isSyncedColumn = (column: ColumnType) => meta.value?.synced && column?.rea:class="{'w-full': props.forceVerticalMode,'!select-text nc-system-field !bg-nc-bg-gray-extralight !text-nc-content-inverted-primary-disabled':- showReadonlyColumnTooltip(col),+ showReadonlyColumnTooltip(col) || isParentLtarColumn(col),'!select-text nc-readonly-div-data-cell': readOnly || !isAllowed || isSyncedColumn(col),}">@@ -187,7 +198,7 @@ const isSyncedColumn = (column: ColumnType) => meta.value?.synced && column?.reav-if="isVirtualCol(col)"v-model="_row.row[col.title]":column="col"- :read-only="readOnly || !isAllowed || isSyncedColumn(col)"+ :read-only="readOnly || !isAllowed || isSyncedColumn(col) || isParentLtarColumn(col)":row="_row":is-allowed="isAllowed"/>@@ -224,7 +235,7 @@ const isSyncedColumn = (column: ColumnType) => meta.value?.synced && column?.rea<!-- Add Blueprint button below LTAR fields in template mode --><div- v-if="isTemplateMode && isLinksOrLTAR(col) && !readOnly"+ v-if="isTemplateMode && isLinksOrLTAR(col) && !readOnly && !isParentLtarColumn(col)"class="flex items-center":class="{'flex-row <lg:pl-0': !props.forceVerticalMode,@@ -235,15 +246,20 @@ const isSyncedColumn = (column: ColumnType) => meta.value?.synced && column?.reav-if="!props.forceVerticalMode"class="flex-none w-45 <lg:hidden sm:mx-2"/>- <NcTooltip placement="bottom">- <template #title>Define a new record that will be created and linked each time this template is used</template>- <NcButton type="secondary" size="xs" class="!mt-1" @click.stop="addBlueprintForColumn(col)">+ <div class="flex items-center gap-2">+ <NcButton type="secondary" size="small" class="!mt-1" @click.stop="addBlueprintForColumn(col)"><div class="flex items-center gap-1"><GeneralIcon icon="plus" class="h-3.5 w-3.5" /><span>Add {{ getRelatedTableName(col) }} Template</span></div></NcButton>- </NcTooltip>+ <NcTooltip placement="bottom" class="flex items-center !mt-1">+ <template #title>+ A new {{ getRelatedTableName(col) }} record will be created and linked each time this template is used+ </template>+ <GeneralIcon icon="info" class="h-3.5 w-3.5 text-nc-content-gray-subtle" />+ </NcTooltip>+ </div></div></div></template>diff --git a/packages/nc-gui/components/virtual-cell/components/ItemChip.vue b/packages/nc-gui/components/virtual-cell/components/ItemChip.vueindex 633f05e375..6096496ac8 100644--- a/packages/nc-gui/components/virtual-cell/components/ItemChip.vue+++ b/packages/nc-gui/components/virtual-cell/components/ItemChip.vue@@ -25,6 +25,8 @@ const { relatedTableMeta, externalBaseUserRoles, row: parentRow } = useLTARStoreconst injectedColumn = inject(ColumnInj, ref())+const parentTableMeta = inject(MetaInj, ref())+const { isUIAllowed } = useRoles()provide(IsUnderLTARInj, ref(true))@@ -66,6 +68,7 @@ function openBlueprintEditor() {loadRow: false,useMetaFields: true,blueprintMode: true,+ blueprintParentTableId: parentTableMeta.value?.id,newRecordSubmitBtnText: 'Save Blueprint',newRecordHeader: `Edit ${relatedTableMeta.value?.title} (Blueprint)`,createdRecord: (record: Record<string, any>) => {diff --git a/packages/nc-gui/composables/useExpandedFormDetached/index.ts b/packages/nc-gui/composables/useExpandedFormDetached/index.tsindex 9fd674c3ca..622c6a521a 100644--- a/packages/nc-gui/composables/useExpandedFormDetached/index.ts+++ b/packages/nc-gui/composables/useExpandedFormDetached/index.ts@@ -20,6 +20,7 @@ export interface UseExpandedFormDetachedProps {'newRecordHeader'?: string'existingTemplateNames'?: string[]'editingTemplateId'?: string+ 'blueprintParentTableId'?: string'createdRecord'?: (row: Row['row']) => void}diff --git a/packages/nc-gui/context/index.ts b/packages/nc-gui/context/index.tsindex 4d44806ba4..e55e437e87 100644--- a/packages/nc-gui/context/index.ts+++ b/packages/nc-gui/context/index.ts@@ -152,6 +152,8 @@ export const IsOrgBillingInj: InjectionKey<Ref<boolean>> = Symbol('is-org-billinexport const IsTemplateModeInj: InjectionKey<Ref<boolean>> = Symbol('is-template-mode-injection')+export const BlueprintParentTableIdInj: InjectionKey<Ref<string | undefined>> = Symbol('blueprint-parent-table-id-injection')+export const WorkflowVariableInj: InjectionKey<{selectedNodeId: Ref<string | null>getAvailableVariablesFlat: (nodeId: string) => any[]