Adds _id and _rev back to internal datasource filter options (#13977)
* Adds _id and _rev back to internal datasource filter options * add bb default datasource const into shared-core * re-export var from shared-core
This commit is contained in:
parent
a850ce6996
commit
aefe46b253
|
@ -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_EXPENSES_TABLE_ID = "ta_bb_expenses"
|
||||
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"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import FilterUsers from "./FilterUsers.svelte"
|
||||
import { getFields } from "../utils/searchFields"
|
||||
|
||||
const { OperatorOptions } = Constants
|
||||
const { OperatorOptions, DEFAULT_BB_DATASOURCE_ID } = Constants
|
||||
|
||||
export let schemaFields
|
||||
export let filters = []
|
||||
|
@ -28,6 +28,23 @@
|
|||
export let allowBindings = false
|
||||
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
|
||||
$: onEmptyFilter =
|
||||
filters?.find(filter => filter.onEmptyFilter)?.onEmptyFilter ?? "all"
|
||||
|
@ -35,7 +52,6 @@
|
|||
$: fieldFilters = filters.filter(
|
||||
filter => filter.operator !== "allOr" && !filter.onEmptyFilter
|
||||
)
|
||||
|
||||
const behaviourOptions = [
|
||||
{ value: "and", label: "Match all filters" },
|
||||
{ value: "or", label: "Match any filter" },
|
||||
|
@ -44,7 +60,6 @@
|
|||
{ value: "all", label: "Return all table rows" },
|
||||
{ value: "none", label: "Return no rows" },
|
||||
]
|
||||
|
||||
const context = getContext("context")
|
||||
|
||||
$: fieldOptions = getFields(tables, schemaFields || [], {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
/**
|
||||
* 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"
|
||||
import { BpmCorrelationKey } from "@budibase/shared-core"
|
||||
import { FieldType, BBReferenceFieldSubType } from "@budibase/types"
|
||||
|
|
|
@ -180,3 +180,5 @@ export enum BpmStatusValue {
|
|||
VERIFYING_EMAIL = "verifying_email",
|
||||
COMPLETED = "completed",
|
||||
}
|
||||
|
||||
export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"
|
||||
|
|
Loading…
Reference in New Issue