Browse Source

Merge pull request #3709 from nocodb/fix/filter-dropdown-bugs

Fix: Filter - webhook and view filter bugs
pull/3712/head
Raju Udava 2 years ago committed by GitHub
parent
commit
663c7491e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      packages/nc-gui/components/smartsheet-toolbar/ColumnFilter.vue
  2. 1
      packages/nc-gui/components/webhook/Editor.vue
  3. 4
      packages/nc-gui/composables/useViewFilters.ts

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

@ -23,9 +23,10 @@ interface Props {
hookId?: string hookId?: string
showLoading?: boolean showLoading?: boolean
modelValue?: Filter[] modelValue?: Filter[]
webHook?: boolean
} }
const { nested = false, parentId, autoSave = true, hookId = null, modelValue, showLoading = true } = defineProps<Props>() const { nested = false, parentId, autoSave = true, hookId = null, modelValue, showLoading = true, webHook } = defineProps<Props>()
const emit = defineEmits(['update:filtersLength']) const emit = defineEmits(['update:filtersLength'])
@ -101,13 +102,13 @@ const types = computed(() => {
watch( watch(
() => activeView.value?.id, () => activeView.value?.id,
(n, o) => { (n, o) => {
if (n !== o) loadFilters(hookId as string) if (n !== o && (hookId || !webHook)) loadFilters(hookId as string)
}, },
{ immediate: true }, { immediate: true },
) )
watch( watch(
() => filters.value.length, () => filters.value.length ,
(length) => { (length) => {
emit('update:filtersLength', length ?? 0) emit('update:filtersLength', length ?? 0)
}, },
@ -137,7 +138,7 @@ defineExpose({
:class="{ 'shadow min-w-[430px] max-w-[630px] max-h-[max(80vh,500px)] overflow-auto': !nested, 'border-1 w-full': nested }" :class="{ 'shadow min-w-[430px] max-w-[630px] max-h-[max(80vh,500px)] overflow-auto': !nested, 'border-1 w-full': nested }"
> >
<div v-if="filters && filters.length" class="nc-filter-grid mb-2" @click.stop> <div v-if="filters && filters.length" class="nc-filter-grid mb-2" @click.stop>
<template v-for="(filter, i) in filters" :key="filter.id || i"> <template v-for="(filter, i) in filters" :key="i">
<template v-if="filter.status !== 'delete'"> <template v-if="filter.status !== 'delete'">
<template v-if="filter.is_group"> <template v-if="filter.is_group">
<MdiCloseBox <MdiCloseBox
@ -280,7 +281,7 @@ defineExpose({
{{ $t('activity.addFilter') }} {{ $t('activity.addFilter') }}
</div> </div>
</a-button> </a-button>
<a-button class="text-capitalize !text-gray-500" @click.stop="addFilterGroup"> <a-button class="text-capitalize !text-gray-500" v-if="!webHook" @click.stop="addFilterGroup">
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<!-- <v-icon small color="grey"> mdi-plus </v-icon> --> <!-- <v-icon small color="grey"> mdi-plus </v-icon> -->
<!-- Add Filter Group --> <!-- Add Filter Group -->

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

@ -619,6 +619,7 @@ onMounted(async () => {
:auto-save="false" :auto-save="false"
:show-loading="false" :show-loading="false"
:hook-id="hook.id" :hook-id="hook.id"
web-hook
/> />
</a-card> </a-card>
</a-col> </a-col>

4
packages/nc-gui/composables/useViewFilters.ts

@ -183,12 +183,12 @@ export function useViewFilters(
} }
const addFilter = () => { const addFilter = () => {
filters.value.push(placeholderFilter) filters.value.push({ ...placeholderFilter })
$e('a:filter:add', { length: filters.value.length }) $e('a:filter:add', { length: filters.value.length })
} }
const addFilterGroup = async () => { const addFilterGroup = async () => {
const child = placeholderFilter const child = { ...placeholderFilter }
const placeHolderGroupFilter: Filter = { const placeHolderGroupFilter: Filter = {
is_group: true, is_group: true,
status: 'create', status: 'create',

Loading…
Cancel
Save