Merge branch 'master' into fix/relationship-filtering-table-or-column

This commit is contained in:
Michael Drury 2024-06-24 14:35:30 +01:00 committed by GitHub
commit 0d946e7be3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 5 deletions

View File

@ -72,4 +72,4 @@ export const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs"
export const DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory" export const DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory"
export const DEFAULT_EXPENSES_TABLE_ID = "ta_bb_expenses" export const DEFAULT_EXPENSES_TABLE_ID = "ta_bb_expenses"
export const DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee" export const DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee"
export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default" export { DEFAULT_BB_DATASOURCE_ID } from "@budibase/shared-core"

View File

@ -18,7 +18,7 @@
import FilterUsers from "./FilterUsers.svelte" import FilterUsers from "./FilterUsers.svelte"
import { getFields } from "../utils/searchFields" import { getFields } from "../utils/searchFields"
const { OperatorOptions } = Constants const { OperatorOptions, DEFAULT_BB_DATASOURCE_ID } = Constants
export let schemaFields export let schemaFields
export let filters = [] export let filters = []
@ -28,6 +28,23 @@
export let allowBindings = false export let allowBindings = false
export let filtersLabel = "Filters" export let filtersLabel = "Filters"
$: {
if (
tables.find(
table =>
table._id === datasource.tableId &&
table.sourceId === DEFAULT_BB_DATASOURCE_ID
) &&
!schemaFields.some(field => field.name === "_id")
) {
schemaFields = [
...schemaFields,
{ name: "_id", type: "string" },
{ name: "_rev", type: "string" },
]
}
}
$: matchAny = filters?.find(filter => filter.operator === "allOr") != null $: matchAny = filters?.find(filter => filter.operator === "allOr") != null
$: onEmptyFilter = $: onEmptyFilter =
filters?.find(filter => filter.onEmptyFilter)?.onEmptyFilter ?? "all" filters?.find(filter => filter.onEmptyFilter)?.onEmptyFilter ?? "all"
@ -35,7 +52,6 @@
$: fieldFilters = filters.filter( $: fieldFilters = filters.filter(
filter => filter.operator !== "allOr" && !filter.onEmptyFilter filter => filter.operator !== "allOr" && !filter.onEmptyFilter
) )
const behaviourOptions = [ const behaviourOptions = [
{ value: "and", label: "Match all filters" }, { value: "and", label: "Match all filters" },
{ value: "or", label: "Match any filter" }, { value: "or", label: "Match any filter" },
@ -44,7 +60,6 @@
{ value: "all", label: "Return all table rows" }, { value: "all", label: "Return all table rows" },
{ value: "none", label: "Return no rows" }, { value: "none", label: "Return no rows" },
] ]
const context = getContext("context") const context = getContext("context")
$: fieldOptions = getFields(tables, schemaFields || [], { $: fieldOptions = getFields(tables, schemaFields || [], {

View File

@ -1,7 +1,11 @@
/** /**
* Operator options for lucene queries * Operator options for lucene queries
*/ */
export { OperatorOptions, SqlNumberTypeRangeMap } from "@budibase/shared-core" export {
OperatorOptions,
SqlNumberTypeRangeMap,
DEFAULT_BB_DATASOURCE_ID,
} from "@budibase/shared-core"
export { Feature as Features } from "@budibase/types" export { Feature as Features } from "@budibase/types"
import { BpmCorrelationKey } from "@budibase/shared-core" import { BpmCorrelationKey } from "@budibase/shared-core"
import { FieldType, BBReferenceFieldSubType } from "@budibase/types" import { FieldType, BBReferenceFieldSubType } from "@budibase/types"

View File

@ -180,3 +180,5 @@ export enum BpmStatusValue {
VERIFYING_EMAIL = "verifying_email", VERIFYING_EMAIL = "verifying_email",
COMPLETED = "completed", COMPLETED = "completed",
} }
export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"