Merge pull request #14006 from Budibase/fix-relationship-filtering

Fix missing operator options when filtering on relationships
This commit is contained in:
Andrew Kingston 2024-06-28 09:32:19 +02:00 committed by GitHub
commit 26b4288c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 8 deletions

View File

@ -43,7 +43,7 @@
EditorModes, EditorModes,
} from "components/common/CodeEditor" } from "components/common/CodeEditor"
import FilterBuilder from "components/design/settings/controls/FilterEditor/FilterBuilder.svelte" import FilterBuilder from "components/design/settings/controls/FilterEditor/FilterBuilder.svelte"
import { QueryUtils, Utils } from "@budibase/frontend-core" import { QueryUtils, Utils, search } from "@budibase/frontend-core"
import { import {
getSchemaForDatasourcePlus, getSchemaForDatasourcePlus,
getEnvironmentBindings, getEnvironmentBindings,
@ -75,7 +75,11 @@
$: schema = getSchemaForDatasourcePlus(tableId, { $: schema = getSchemaForDatasourcePlus(tableId, {
searchableSchema: true, searchableSchema: true,
}).schema }).schema
$: schemaFields = Object.values(schema || {}) $: schemaFields = search.getFields(
$tables.list,
Object.values(schema || {}),
{ allowLinks: true }
)
$: queryLimit = tableId?.includes("datasource") ? "∞" : "1000" $: queryLimit = tableId?.includes("datasource") ? "∞" : "1000"
$: isTrigger = block?.type === "TRIGGER" $: isTrigger = block?.type === "TRIGGER"
$: isUpdateRow = stepId === ActionStepID.UPDATE_ROW $: isUpdateRow = stepId === ActionStepID.UPDATE_ROW

View File

@ -9,7 +9,8 @@
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding" import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
import FilterBuilder from "./FilterBuilder.svelte" import FilterBuilder from "./FilterBuilder.svelte"
import { selectedScreen } from "stores/builder" import { tables, selectedScreen } from "stores/builder"
import { search } from "@budibase/frontend-core"
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -23,7 +24,11 @@
$: tempValue = value $: tempValue = value
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance) $: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
$: dsSchema = getSchemaForDatasource($selectedScreen, datasource)?.schema $: dsSchema = getSchemaForDatasource($selectedScreen, datasource)?.schema
$: schemaFields = Object.values(schema || dsSchema || {}) $: schemaFields = search.getFields(
$tables.list,
Object.values(schema || dsSchema || {}),
{ allowLinks: true }
)
$: text = getText(value?.filter(filter => filter.field)) $: text = getText(value?.filter(filter => filter.field))
async function saveFilter() { async function saveFilter() {

View File

@ -16,7 +16,6 @@
import { QueryUtils, Constants } from "@budibase/frontend-core" import { QueryUtils, Constants } from "@budibase/frontend-core"
import { getContext } from "svelte" import { getContext } from "svelte"
import FilterUsers from "./FilterUsers.svelte" import FilterUsers from "./FilterUsers.svelte"
import { getFields } from "../utils/searchFields"
const { OperatorOptions, DEFAULT_BB_DATASOURCE_ID } = Constants const { OperatorOptions, DEFAULT_BB_DATASOURCE_ID } = Constants
@ -62,9 +61,7 @@
] ]
const context = getContext("context") const context = getContext("context")
$: fieldOptions = getFields(tables, schemaFields || [], { $: fieldOptions = (schemaFields || []).map(field => ({
allowLinks: true,
}).map(field => ({
label: field.displayName || field.name, label: field.displayName || field.name,
value: field.name, value: field.name,
})) }))