Merge commit
This commit is contained in:
parent
7dbc45ec82
commit
7703da159d
|
@ -182,3 +182,8 @@ export const OnEmptyFilter = {
|
||||||
RETURN_ALL: "all",
|
RETURN_ALL: "all",
|
||||||
RETURN_NONE: "none",
|
RETURN_NONE: "none",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const FilterValueType = {
|
||||||
|
BINDING: "Binding",
|
||||||
|
VALUE: "Value",
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants"
|
||||||
import { deepGet, schema } from "./helpers"
|
import { deepGet, schema } from "./helpers"
|
||||||
import { isPlainObject, isEmpty } from "lodash"
|
import { isPlainObject, isEmpty } from "lodash"
|
||||||
import { decodeNonAscii } from "./helpers/schema"
|
import { decodeNonAscii } from "./helpers/schema"
|
||||||
// import { Constants } from "@budibase/frontend-core"
|
|
||||||
|
|
||||||
const HBS_REGEX = /{{([^{].*?)}}/g
|
const HBS_REGEX = /{{([^{].*?)}}/g
|
||||||
|
|
||||||
|
@ -293,20 +292,21 @@ export class ColumnSplitter {
|
||||||
const builderFilter = (expression: SearchFilter) => {
|
const builderFilter = (expression: SearchFilter) => {
|
||||||
// Filter body
|
// Filter body
|
||||||
let query: SearchFilters = {
|
let query: SearchFilters = {
|
||||||
// string: {},
|
string: {},
|
||||||
// fuzzy: {},
|
fuzzy: {},
|
||||||
// range: {},
|
range: {},
|
||||||
// equal: {},
|
equal: {},
|
||||||
// notEqual: {},
|
notEqual: {},
|
||||||
// empty: {},
|
empty: {},
|
||||||
// notEmpty: {},
|
notEmpty: {},
|
||||||
// contains: {},
|
contains: {},
|
||||||
// notContains: {},
|
notContains: {},
|
||||||
// oneOf: {},
|
oneOf: {},
|
||||||
// containsAny: {},
|
containsAny: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEAN -
|
// DEAN -
|
||||||
|
|
||||||
// This is the chattiest service we have, pruning the requests
|
// This is the chattiest service we have, pruning the requests
|
||||||
// of bloat should have meaningful impact
|
// of bloat should have meaningful impact
|
||||||
// Further validation in this area is a must
|
// Further validation in this area is a must
|
||||||
|
@ -427,6 +427,7 @@ export const buildQuery = (filter: SearchFilter[]) => {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEAN Replace with builderFilter
|
||||||
filter.forEach(expression => {
|
filter.forEach(expression => {
|
||||||
let { operator, field, type, value, externalType, onEmptyFilter } =
|
let { operator, field, type, value, externalType, onEmptyFilter } =
|
||||||
expression
|
expression
|
||||||
|
@ -527,10 +528,12 @@ export const buildQuery = (filter: SearchFilter[]) => {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Grouped query
|
||||||
* FOR TESTING - this still isnt type safe
|
|
||||||
*/
|
|
||||||
export const buildQueryX = (filter: SearchFilterGroup) => {
|
export const buildQueryX = (filter: SearchFilterGroup) => {
|
||||||
|
if (!filter) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
const operatorMap = {
|
const operatorMap = {
|
||||||
[FilterGroupLogicalOperator.ALL]: LogicalOperator.AND,
|
[FilterGroupLogicalOperator.ALL]: LogicalOperator.AND,
|
||||||
[FilterGroupLogicalOperator.ANY]: LogicalOperator.OR,
|
[FilterGroupLogicalOperator.ANY]: LogicalOperator.OR,
|
||||||
|
@ -545,7 +548,7 @@ export const buildQueryX = (filter: SearchFilterGroup) => {
|
||||||
conditions: filter.groups?.map((group: SearchFilterGroup) => {
|
conditions: filter.groups?.map((group: SearchFilterGroup) => {
|
||||||
return {
|
return {
|
||||||
[operatorMap[group.logicalOperator]]: {
|
[operatorMap[group.logicalOperator]]: {
|
||||||
conditions: group.filters?.map(x => builderFilter(x)), //buildFilters
|
conditions: group.filters?.map(x => builderFilter(x)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { SearchFilter, SortOrder, SortType } from "../../api"
|
import { SearchFilter, SearchFilterGroup, SortOrder, SortType } from "../../api"
|
||||||
import { UIFieldMetadata } from "./table"
|
import { UIFieldMetadata } from "./table"
|
||||||
import { Document } from "../document"
|
import { Document } from "../document"
|
||||||
import { DBView } from "../../sdk"
|
import { DBView } from "../../sdk"
|
||||||
|
@ -56,7 +56,7 @@ export interface ViewV2 {
|
||||||
name: string
|
name: string
|
||||||
primaryDisplay?: string
|
primaryDisplay?: string
|
||||||
tableId: string
|
tableId: string
|
||||||
query?: SearchFilter[]
|
query?: SearchFilter[] | SearchFilterGroup
|
||||||
sort?: {
|
sort?: {
|
||||||
field: string
|
field: string
|
||||||
order?: SortOrder
|
order?: SortOrder
|
||||||
|
|
Loading…
Reference in New Issue