Browse Source

fix: delete filters(webhook) when saving if found any

pull/7246/head
Pranav C 11 months ago
parent
commit
c09588ac85
  1. 13
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  2. 12
      packages/nc-gui/components/webhook/Editor.vue

13
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -208,8 +208,17 @@ const filtersCount = computed(() => {
}, 0)
})
const applyChanges = async (hookId?: string, _nested = false) => {
await sync(hookId, _nested)
const applyChanges = async (hookId?: string, nested = false, isConditionSupported = true) => {
// if condition is not supported, delete all filters present
// it's used for bulk webhooks with filters since bulk webhooks don't support conditions at the moment
if (!isConditionSupported) {
// iterate in reverse order and delete all filters, reverse order is for getting the correct index
for (let i = localNestedFilters.value.length - 1; i >= 0; i--) {
await deleteFilter(localNestedFilters.value[i], i)
}
}
await sync(hookId, nested)
if (!localNestedFilters.value?.length) return

12
packages/nc-gui/components/webhook/Editor.vue

@ -403,6 +403,10 @@ async function loadPluginList() {
}
}
const isConditionSupport = computed(() => {
return hookRef.eventOperation && !hookRef.eventOperation.includes('bulk')
})
async function saveHooks() {
loading.value = true
try {
@ -446,7 +450,7 @@ async function saveHooks() {
}
if (filterRef.value) {
await filterRef.value.applyChanges(hookRef.id)
await filterRef.value.applyChanges(hookRef.id, false, isConditionSupport.value)
}
// Webhook details updated successfully
@ -520,10 +524,6 @@ onMounted(async () => {
}
}, 50)
})
const isConditionSupport = computed(() => {
return hookRef.eventOperation && !hookRef.eventOperation.includes('bulk')
})
</script>
<template>
@ -774,7 +774,7 @@ const isConditionSupport = computed(() => {
</a-form-item>
</a-col>
</a-row>
<a-row class="mb-5" type="flex" v-if="isConditionSupport">
<a-row v-show="isConditionSupport" class="mb-5" type="flex">
<a-col :span="24">
<div class="rounded-lg border-1 p-6">
<a-checkbox

Loading…
Cancel
Save