Filter user (single) UI
This commit is contained in:
parent
af924ae4a2
commit
3b93748376
|
@ -17,7 +17,9 @@
|
|||
import { generate } from "shortid"
|
||||
import { LuceneUtils, Constants } from "@budibase/frontend-core"
|
||||
import { getFields } from "helpers/searchFields"
|
||||
import { FieldType } from "@budibase/types"
|
||||
import { createEventDispatcher, onMount } from "svelte"
|
||||
import FilterUsers from "./FilterUsers.svelte"
|
||||
|
||||
export let schemaFields
|
||||
export let filters = []
|
||||
|
@ -285,6 +287,8 @@
|
|||
timeOnly={getSchema(filter)?.timeOnly}
|
||||
bind:value={filter.value}
|
||||
/>
|
||||
{:else if filter.type === FieldType.BB_REFERENCE}
|
||||
<FilterUsers {filter} />
|
||||
{:else}
|
||||
<DrawerBindableInput disabled />
|
||||
{/if}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<script>
|
||||
import { Select } from "@budibase/bbui"
|
||||
import { fetchData } from "@budibase/frontend-core"
|
||||
|
||||
import { API } from "api"
|
||||
|
||||
export let filter
|
||||
|
||||
$: fetch = fetchData({
|
||||
API,
|
||||
datasource: {
|
||||
type: "user",
|
||||
},
|
||||
options: {
|
||||
limit: 100,
|
||||
},
|
||||
})
|
||||
|
||||
$: options = $fetch.rows
|
||||
</script>
|
||||
|
||||
<Select
|
||||
autocomplete
|
||||
bind:value={filter.value}
|
||||
{options}
|
||||
getOptionLabel={option => option.email}
|
||||
getOptionValue={option => option._id}
|
||||
/>
|
|
@ -60,6 +60,8 @@ export const getValidOperatorsForType = (
|
|||
ops = numOps
|
||||
} else if (type === FieldType.FORMULA) {
|
||||
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
|
||||
} else if (type === FieldType.BB_REFERENCE) {
|
||||
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
||||
}
|
||||
|
||||
// Only allow equal/not equal for _id in SQL tables
|
||||
|
|
Loading…
Reference in New Issue