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,
} from "components/common/CodeEditor"
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 {
getSchemaForDatasourcePlus,
getEnvironmentBindings,
@ -75,7 +75,11 @@
$: schema = getSchemaForDatasourcePlus(tableId, {
searchableSchema: true,
}).schema
$: schemaFields = Object.values(schema || {})
$: schemaFields = search.getFields(
$tables.list,
Object.values(schema || {}),
{ allowLinks: true }
)
$: queryLimit = tableId?.includes("datasource") ? "∞" : "1000"
$: isTrigger = block?.type === "TRIGGER"
$: isUpdateRow = stepId === ActionStepID.UPDATE_ROW

View File

@ -9,7 +9,8 @@
import { createEventDispatcher } from "svelte"
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
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()
@ -23,7 +24,11 @@
$: tempValue = value
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
$: 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))
async function saveFilter() {

View File

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