Browse Source

fix: exclude unsupported columns

pull/8367/head
Pranav C 5 months ago
parent
commit
21c2ff8af9
  1. 22
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue
  2. 14
      packages/nc-gui/components/smartsheet/header/Menu.vue

22
packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

@ -47,9 +47,18 @@ if (!isEdit.value) {
if (!vModel.value.onDelete) vModel.value.onDelete = onUpdateDeleteOptions[0] if (!vModel.value.onDelete) vModel.value.onDelete = onUpdateDeleteOptions[0]
if (!vModel.value.virtual) vModel.value.virtual = sqlUi === SqliteUi // appInfo.isCloud || sqlUi === SqliteUi if (!vModel.value.virtual) vModel.value.virtual = sqlUi === SqliteUi // appInfo.isCloud || sqlUi === SqliteUi
if (!vModel.value.alias) vModel.value.alias = vModel.value.column_name if (!vModel.value.alias) vModel.value.alias = vModel.value.column_name
} else {
if (!vModel.value.childId)
vModel.custom = {
ref_model_id: vModel.value?.colOptions?.fk_related_model_id,
base_id: meta.value?.base_id,
junc_base_id: meta.value?.base_id,
}
if (!vModel.value.childViewId) vModel.value.childViewId = vModel.value?.colOptions?.fk_target_view_id || null
} }
if (!vModel.value.childId) vModel.value.childId = vModel.value?.colOptions?.fk_related_model_id || null if (!vModel.value.childId) vModel.value.childId = vModel.value?.colOptions?.fk_related_model_id || null
if (!vModel.value.childViewId) vModel.value.childViewId = vModel.value?.colOptions?.fk_target_view_id || null if (!vModel.value.childViewId) vModel.value.childViewId = vModel.value?.colOptions?.fk_target_view_id || null
if (!vModel.value.type) vModel.value.type = vModel.value?.colOptions?.type || 'mm'
const advancedOptions = ref(false) const advancedOptions = ref(false)
@ -221,11 +230,18 @@ const handleShowAdvanceOptions = () => {
</a-form-item> </a-form-item>
</div> </div>
<div v-if="isAdvancedOptionsShownEasterEgg && isEeUI"> <div v-if="isAdvancedOptionsShownEasterEgg && isEeUI">
<a-switch v-model:checked="vModel.is_custom_link" size="small" name="Custom" @change="onCustomSwitchToggle" /> <a-switch
v-model:checked="vModel.is_custom_link"
:disabled="isEdit"
:is-edit="isEdit"
size="small"
name="Custom"
@change="onCustomSwitchToggle"
/>
<span class="ml-3">Advanced Link</span> <span class="ml-3">Advanced Link</span>
</div> </div>
<div v-if="isEeUI && vModel.is_custom_link" :class="{}"> <div v-if="isEeUI && vModel.is_custom_link">
<LazySmartsheetColumnLinkAdvancedOptions v-model:value="vModel" :meta="meta" /> <LazySmartsheetColumnLinkAdvancedOptions v-model:value="vModel" :is-edit="isEdit" :meta="meta" />
</div> </div>
<template v-else> <template v-else>
<a-form-item class="flex w-full pb-2 nc-ltar-child-table" v-bind="validateInfos.childId"> <a-form-item class="flex w-full pb-2 nc-ltar-child-table" v-bind="validateInfos.childId">

14
packages/nc-gui/components/smartsheet/header/Menu.vue

@ -374,6 +374,13 @@ const isColumnEditAllowed = computed(() => {
return false return false
return true return true
}) })
// check if the column is associated as foreign key in any of the link column
const linksAssociated = computed(() => {
return meta.value?.columns?.filter(
(c) => isLinksOrLTAR(c) && [c.colOptions?.fk_child_column_id, c.colOptions?.fk_parent_column_id].includes(column?.value?.id),
)
})
</script> </script>
<template> <template>
@ -399,7 +406,8 @@ const isColumnEditAllowed = computed(() => {
<GeneralSourceRestrictionTooltip message="Field properties cannot be edited." :enabled="!isColumnEditAllowed"> <GeneralSourceRestrictionTooltip message="Field properties cannot be edited." :enabled="!isColumnEditAllowed">
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('fieldAlter')" v-if="isUIAllowed('fieldAlter')"
:disabled="column?.pk || isSystemColumn(column) || !isColumnEditAllowed" :disabled="column?.pk || isSystemColumn(column) || !isColumnEditAllowed || linksAssociated.length"
:title="linksAssociated.length ? 'Field is associated with a link column' : undefined"
@click="onEditPress" @click="onEditPress"
> >
<div class="nc-column-edit nc-header-menu-item"> <div class="nc-column-edit nc-header-menu-item">
@ -409,7 +417,6 @@ const isColumnEditAllowed = computed(() => {
</div> </div>
</NcMenuItem> </NcMenuItem>
</GeneralSourceRestrictionTooltip> </GeneralSourceRestrictionTooltip>
<GeneralSourceRestrictionTooltip message="Field cannot be duplicated." :enabled="!isDuplicateAllowed"> <GeneralSourceRestrictionTooltip message="Field cannot be duplicated." :enabled="!isDuplicateAllowed">
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('duplicateColumn') && isExpandedForm && !column?.pk" v-if="isUIAllowed('duplicateColumn') && isExpandedForm && !column?.pk"
@ -554,8 +561,9 @@ const isColumnEditAllowed = computed(() => {
<GeneralSourceRestrictionTooltip message="Field cannot be deleted." :enabled="!isColumnUpdateAllowed"> <GeneralSourceRestrictionTooltip message="Field cannot be deleted." :enabled="!isColumnUpdateAllowed">
<NcMenuItem <NcMenuItem
v-if="!column?.pv && isUIAllowed('fieldDelete')" v-if="!column?.pv && isUIAllowed('fieldDelete')"
:disabled="!isDeleteAllowed || !isColumnUpdateAllowed" :disabled="!isDeleteAllowed || !isColumnUpdateAllowed || linksAssociated.length"
class="!hover:bg-red-50" class="!hover:bg-red-50"
:title="linksAssociated ? 'Field is associated with a link column' : undefined"
@click="handleDelete" @click="handleDelete"
> >
<div <div

Loading…
Cancel
Save