1
0
Fork 0
mirror of synced 2024-08-22 21:41:49 +12:00

Updating filter settings - getting fields correctly.

This commit is contained in:
mike12345567 2024-05-24 14:19:53 +01:00
parent b18ca2670a
commit cf89c6fbde
2 changed files with 7 additions and 9 deletions

View file

@ -1,7 +1,7 @@
<script> <script>
import { Multiselect } from "@budibase/bbui" import { Multiselect } from "@budibase/bbui"
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding" import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
import { selectedScreen, tables } from "stores/builder" import { selectedScreen } from "stores/builder"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { getFields } from "helpers/searchFields" import { getFields } from "helpers/searchFields"
@ -20,10 +20,7 @@
if (!ds?.tableId) { if (!ds?.tableId) {
return base.map(field => field.name) return base.map(field => field.name)
} }
const currentTable = $tables.list.find(table => table._id === ds.tableId) return getFields(base, { allowLinks: true }).map(field => field.name)
return getFields(base, { allowLinks: currentTable?.sql }).map(
field => field.name
)
} }
function getSelectedOption(selectedOptions, allOptions) { function getSelectedOption(selectedOptions, allOptions) {

View file

@ -16,6 +16,7 @@
import { LuceneUtils, Constants } from "@budibase/frontend-core" import { LuceneUtils, Constants } from "@budibase/frontend-core"
import { getContext } from "svelte" import { getContext } from "svelte"
import FilterUsers from "./FilterUsers.svelte" import FilterUsers from "./FilterUsers.svelte"
import { getFields } from "@budibase/builder/src/helpers/searchFields"
const { OperatorOptions } = Constants const { OperatorOptions } = Constants
@ -45,12 +46,12 @@
const context = getContext("context") const context = getContext("context")
$: fieldOptions = (schemaFields ?? []) $: fieldOptions = getFields(schemaFields || [], { allowLinks: true }).map(
.filter(field => getValidOperatorsForType(field).length) field => ({
.map(field => ({
label: field.displayName || field.name, label: field.displayName || field.name,
value: field.name, value: field.name,
})) })
)
const addFilter = () => { const addFilter = () => {
filters = [ filters = [