Merge pull request #8804 from Budibase/bug/sev2/external-datasource-id-filtering
External datasource id filtering
This commit is contained in:
commit
5a9f3be757
|
@ -30,9 +30,14 @@
|
||||||
export let allowBindings = true
|
export let allowBindings = true
|
||||||
export let allOr = false
|
export let allOr = false
|
||||||
export let fillWidth = false
|
export let fillWidth = false
|
||||||
|
export let tableId
|
||||||
|
|
||||||
$: dispatch("change", filters)
|
$: dispatch("change", filters)
|
||||||
$: enrichedSchemaFields = getFields(schemaFields || [])
|
$: enrichedSchemaFields = getFields(
|
||||||
|
schemaFields || [],
|
||||||
|
{ allowLinks: true },
|
||||||
|
tableId
|
||||||
|
)
|
||||||
$: fieldOptions = enrichedSchemaFields.map(field => field.name) || []
|
$: fieldOptions = enrichedSchemaFields.map(field => field.name) || []
|
||||||
$: valueTypeOptions = allowBindings ? ["Value", "Binding"] : ["Value"]
|
$: valueTypeOptions = allowBindings ? ["Value", "Binding"] : ["Value"]
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
filters={initialFilters}
|
filters={initialFilters}
|
||||||
{bindings}
|
{bindings}
|
||||||
{schemaFields}
|
{schemaFields}
|
||||||
|
tableId={dataSource.tableId}
|
||||||
bind:allOr
|
bind:allOr
|
||||||
on:change={event => {
|
on:change={event => {
|
||||||
toSaveFilters = event.detail
|
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(
|
let filteredFields = fields.filter(
|
||||||
field => !BannedSearchTypes.includes(field.type)
|
field => !BannedSearchTypes.includes(field.type)
|
||||||
)
|
)
|
||||||
|
@ -30,5 +34,9 @@ export function getFields(fields, { allowLinks } = { allowLinks: true }) {
|
||||||
const staticFormulaFields = fields.filter(
|
const staticFormulaFields = fields.filter(
|
||||||
field => field.type === "formula" && field.formulaType === "static"
|
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)
|
return filteredFields.concat(staticFormulaFields)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue