Browse Source

fix: view and filters on custom links

pull/9051/head
Pranav C 4 months ago
parent
commit
a85c52a3fc
  1. 17
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

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

@ -92,8 +92,10 @@ const refTables = computed(() => {
}) })
const refViews = computed(() => { const refViews = computed(() => {
if (!vModel.value.childId) return [] const childId = vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId
const views = viewsByTable.value.get(vModel.value.childId)
if (!childId) return []
const views = viewsByTable.value.get(childId)
return (views || []).filter((v) => v.type !== ViewTypes.FORM) return (views || []).filter((v) => v.type !== ViewTypes.FORM)
}) })
@ -105,7 +107,7 @@ const isLinks = computed(() => vModel.value.uidt === UITypes.Links && vModel.val
const { metas, getMeta } = useMetas() const { metas, getMeta } = useMetas()
watch( watch(
() => vModel.value.childId, () => (vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId),
async (tableId) => { async (tableId) => {
if (tableId) { if (tableId) {
getMeta(tableId).catch(() => { getMeta(tableId).catch(() => {
@ -146,7 +148,10 @@ const onLimitRecToViewChange = (value: boolean) => {
provide( provide(
MetaInj, MetaInj,
computed(() => metas.value[vModel.value.childId] || {}), computed(() => {
const childId = vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId
return metas.value[childId] || {}
}),
) )
onMounted(() => { onMounted(() => {
@ -305,7 +310,7 @@ const onCustomSwitchLabelClick = () => {
v-model:checked="limitRecToView" v-model:checked="limitRecToView"
v-e="['c:link:limit-record-by-view', { status: limitRecToView }]" v-e="['c:link:limit-record-by-view', { status: limitRecToView }]"
size="small" size="small"
:disabled="!vModel.childId" :disabled="!vModel.childId && !(vModel.is_custom_link && vModel.custom?.ref_model_id)"
@change="onLimitRecToViewChange" @change="onLimitRecToViewChange"
></a-switch> ></a-switch>
<span <span
@ -342,7 +347,7 @@ const onCustomSwitchLabelClick = () => {
<a-switch <a-switch
v-model:checked="limitRecToCond" v-model:checked="limitRecToCond"
v-e="['c:link:limit-record-by-filter', { status: limitRecToCond }]" v-e="['c:link:limit-record-by-filter', { status: limitRecToCond }]"
:disabled="!vModel.childId" :disabled="!vModel.childId && !(vModel.is_custom_link && vModel.custom?.ref_model_id)"
size="small" size="small"
></a-switch> ></a-switch>
<span <span

Loading…
Cancel
Save