Update more usages of processing search filters
This commit is contained in:
parent
b6dbe54236
commit
c8c5cbe16c
|
@ -798,7 +798,9 @@
|
|||
break
|
||||
}
|
||||
}
|
||||
return utils.processSearchFilters(filters)
|
||||
return Array.isArray(filters)
|
||||
? utils.processSearchFilters(filters)
|
||||
: filters
|
||||
}
|
||||
|
||||
function saveFilters(key) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import { getUserBindings } from "dataBinding"
|
||||
import { makePropSafe } from "@budibase/string-templates"
|
||||
import { search } from "@budibase/frontend-core"
|
||||
import { utils } from "@budibase/shared-core"
|
||||
import { tables } from "stores/builder"
|
||||
|
||||
export let schema
|
||||
|
@ -17,7 +16,7 @@
|
|||
|
||||
let drawer
|
||||
|
||||
$: localFilters = utils.processSearchFilters(filters)
|
||||
$: localFilters = filters
|
||||
$: schemaFields = search.getFields(
|
||||
$tables.list,
|
||||
Object.values(schema || {}),
|
||||
|
@ -53,15 +52,7 @@
|
|||
{filterCount ? `Filter: ${filterCount}` : "Filter"}
|
||||
</ActionButton>
|
||||
|
||||
<Drawer
|
||||
bind:this={drawer}
|
||||
title="Filtering"
|
||||
on:drawerHide
|
||||
on:drawerShow={() => {
|
||||
localFilters = utils.processSearchFilters(filters)
|
||||
}}
|
||||
forceModal
|
||||
>
|
||||
<Drawer bind:this={drawer} title="Filtering" on:drawerHide forceModal>
|
||||
<Button
|
||||
cta
|
||||
slot="buttons"
|
||||
|
|
|
@ -207,7 +207,6 @@ export class ComponentStore extends BudiStore {
|
|||
)
|
||||
for (let setting of filterableTypes || []) {
|
||||
const isLegacy = Array.isArray(enrichedComponent[setting.key])
|
||||
|
||||
if (isLegacy) {
|
||||
const processedSetting = utils.processSearchFilters(
|
||||
enrichedComponent[setting.key]
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import { QueryUtils, Constants } from "@budibase/frontend-core"
|
||||
import { getContext, createEventDispatcher } from "svelte"
|
||||
import FilterField from "./FilterField.svelte"
|
||||
import { utils } from "@budibase/shared-core"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const {
|
||||
|
@ -39,8 +40,7 @@
|
|||
export let toReadable
|
||||
export let toRuntime
|
||||
|
||||
$: editableFilters = filters ? Helpers.cloneDeep(filters) : null
|
||||
|
||||
$: editableFilters = migrateFilters(filters)
|
||||
$: {
|
||||
if (
|
||||
tables.find(
|
||||
|
@ -54,6 +54,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
// We still may need to migrate this even though the backend does it automatically nmow
|
||||
// for query definitions. This is because we might be editing saved filter definitions
|
||||
// from old screens, which will still be of type LegacyFilter[]
|
||||
const migrateFilters = filters => {
|
||||
if (Array.isArray(filters)) {
|
||||
return utils.processSearchFilters(filters)
|
||||
}
|
||||
return Helpers.cloneDeep(filters)
|
||||
}
|
||||
|
||||
const filterOperatorOptions = Object.values(FilterOperator).map(entry => {
|
||||
return { value: entry, label: Helpers.capitalise(entry) }
|
||||
})
|
||||
|
|
|
@ -126,6 +126,7 @@ export const initialise = context => {
|
|||
}
|
||||
// Only override filter state if we don't have an initial filter
|
||||
if (!get(initialFilter)) {
|
||||
console.log("setting to", $definition.queryUI)
|
||||
filter.set($definition.queryUI)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue