Merge pull request #8804 from Budibase/bug/sev2/external-datasource-id-filtering
External datasource id filtering
This commit is contained in:
commit
dc15bfd9ba
3 changed files with 16 additions and 2 deletions
|
@ -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"]
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
filters={initialFilters}
|
||||
{bindings}
|
||||
{schemaFields}
|
||||
tableId={dataSource.tableId}
|
||||
bind:allOr
|
||||
on:change={event => {
|
||||
toSaveFilters = event.detail
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue