1
0
Fork 0
mirror of synced 2024-07-18 12:46:16 +12:00

Merge pull request #8804 from Budibase/bug/sev2/external-datasource-id-filtering

External datasource id filtering
This commit is contained in:
melohagan 2022-11-29 11:22:30 +00:00 committed by GitHub
commit dc15bfd9ba
3 changed files with 16 additions and 2 deletions

View file

@ -30,9 +30,14 @@
export let allowBindings = true
export let allOr = false
export let fillWidth = false
export let tableId
$: dispatch("change", filters)
$: enrichedSchemaFields = getFields(schemaFields || [])
$: enrichedSchemaFields = getFields(
schemaFields || [],
{ allowLinks: true },
tableId
)
$: fieldOptions = enrichedSchemaFields.map(field => field.name) || []
$: valueTypeOptions = allowBindings ? ["Value", "Binding"] : ["Value"]

View file

@ -88,6 +88,7 @@
filters={initialFilters}
{bindings}
{schemaFields}
tableId={dataSource.tableId}
bind:allOr
on:change={event => {
toSaveFilters = event.detail

View file

@ -16,7 +16,11 @@ export function getTableFields(linkField) {
}))
}
export function getFields(fields, { allowLinks } = { allowLinks: true }) {
export function getFields(
fields,
{ allowLinks } = { allowLinks: true },
tableId
) {
let filteredFields = fields.filter(
field => !BannedSearchTypes.includes(field.type)
)
@ -30,5 +34,9 @@ export function getFields(fields, { allowLinks } = { allowLinks: true }) {
const staticFormulaFields = fields.filter(
field => field.type === "formula" && field.formulaType === "static"
)
const table = get(tables).list.find(table => table._id === tableId)
if (table?.type === "external") {
filteredFields = filteredFields.filter(field => field.name !== "_id")
}
return filteredFields.concat(staticFormulaFields)
}