Browse Source

refactor(nc-gui): pass `showLoading` as prop to ColumnFilter

pull/3646/head
braks 2 years ago
parent
commit
1c7883d165
  1. 5
      packages/nc-gui/components/smartsheet-toolbar/ColumnFilter.vue
  2. 8
      packages/nc-gui/components/webhook/Editor.vue
  3. 10
      packages/nc-gui/composables/useViewFilters.ts

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

@ -21,10 +21,11 @@ interface Props {
parentId?: string
autoSave: boolean
hookId?: string
showLoading?: boolean
modelValue?: Filter[]
}
const { nested = false, parentId, autoSave = true, hookId = null, modelValue } = defineProps<Props>()
const { nested = false, parentId, autoSave = true, hookId = null, modelValue, showLoading = true } = defineProps<Props>()
const emit = defineEmits(['update:filtersLength'])
@ -46,7 +47,7 @@ const { filters, deleteFilter, saveOrUpdate, loadFilters, addFilter, addFilterGr
activeView,
parentId,
computed(() => autoSave),
reloadDataHook.trigger,
() => reloadDataHook.trigger(showLoading),
modelValue || nestedFilters.value,
!modelValue,
)

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

@ -606,7 +606,13 @@ onMounted(async () => {
<a-col :span="24">
<a-card>
<a-checkbox v-model:checked="hook.condition" class="nc-check-box-hook-condition">On Condition</a-checkbox>
<SmartsheetToolbarColumnFilter v-if="hook.condition" ref="filterRef" :auto-save="false" :hook-id="hook.id" />
<SmartsheetToolbarColumnFilter
v-if="hook.condition"
ref="filterRef"
:auto-save="false"
:show-loading="false"
:hook-id="hook.id"
/>
</a-card>
</a-col>
</a-row>

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

@ -19,7 +19,7 @@ export function useViewFilters(
view: Ref<ViewType | undefined>,
parentId?: string,
autoApply?: ComputedRef<boolean>,
reloadData?: (showLoading?: boolean) => void,
reloadData?: () => void,
currentFilters?: Filter[],
isNestedRoot?: boolean,
) {
@ -110,7 +110,7 @@ export function useViewFilters(
}
}
reloadData?.(false)
reloadData?.()
} catch (e: any) {
console.log(e)
message.error(await extractSdkResponseErrorMsg(e))
@ -122,7 +122,7 @@ export function useViewFilters(
if (nestedMode.value) {
filters.value.splice(i, 1)
filters.value = [...filters.value]
reloadData?.(false)
reloadData?.()
} else {
if (filter.id) {
// if auto-apply disabled mark it as disabled
@ -133,7 +133,7 @@ export function useViewFilters(
try {
await $api.dbTableFilter.delete(filter.id)
reloadData?.(false)
reloadData?.()
filters.value.splice(i, 1)
} catch (e: any) {
@ -179,7 +179,7 @@ export function useViewFilters(
message.error(await extractSdkResponseErrorMsg(e))
}
reloadData?.(false)
reloadData?.()
}
const addFilter = () => {

Loading…
Cancel
Save