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 5a9f3be757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
}