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 parentId?: string
autoSave: boolean autoSave: boolean
hookId?: string hookId?: string
showLoading?: boolean
modelValue?: Filter[] 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']) const emit = defineEmits(['update:filtersLength'])
@ -46,7 +47,7 @@ const { filters, deleteFilter, saveOrUpdate, loadFilters, addFilter, addFilterGr
activeView, activeView,
parentId, parentId,
computed(() => autoSave), computed(() => autoSave),
reloadDataHook.trigger, () => reloadDataHook.trigger(showLoading),
modelValue || nestedFilters.value, modelValue || nestedFilters.value,
!modelValue, !modelValue,
) )

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

@ -606,7 +606,13 @@ onMounted(async () => {
<a-col :span="24"> <a-col :span="24">
<a-card> <a-card>
<a-checkbox v-model:checked="hook.condition" class="nc-check-box-hook-condition">On Condition</a-checkbox> <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-card>
</a-col> </a-col>
</a-row> </a-row>

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

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

Loading…
Cancel
Save