Feedback update for reactive filter statements

This commit is contained in:
Dean 2023-01-23 12:26:59 +00:00
parent 45b907cfde
commit 6071b650d7
1 changed files with 19 additions and 16 deletions

View File

@ -32,24 +32,9 @@
let exportFormat = FORMATS[0].key let exportFormat = FORMATS[0].key
let filterLookup let filterLookup
let exportOpDisplay = []
$: luceneFilter = LuceneUtils.buildLuceneQuery(filters) $: luceneFilter = LuceneUtils.buildLuceneQuery(filters)
$: exportOpDisplay = buildExportOpDisplay(sorting, filterDisplay, filters)
$: if (filters) {
exportOpDisplay = filterDisplay()
}
$: if (sorting) {
exportOpDisplay = [
...exportOpDisplay,
{
Field: sorting.sortColumn,
Operation: "Order By",
"Field Value": sorting.sortOrder,
},
]
}
const buildFilterLookup = () => { const buildFilterLookup = () => {
return Object.keys(Constants.OperatorOptions).reduce((acc, key) => { return Object.keys(Constants.OperatorOptions).reduce((acc, key) => {
@ -61,6 +46,9 @@
filterLookup = buildFilterLookup() filterLookup = buildFilterLookup()
const filterDisplay = () => { const filterDisplay = () => {
if (!filters) {
return []
}
return filters.map(filter => { return filters.map(filter => {
let newFieldName = filter.field + "" let newFieldName = filter.field + ""
const parts = newFieldName.split(":") const parts = newFieldName.split(":")
@ -74,6 +62,21 @@
}) })
} }
const buildExportOpDisplay = (sorting, filterDisplay) => {
let filterDisplayConfig = filterDisplay()
if (sorting) {
filterDisplayConfig = [
...filterDisplayConfig,
{
Field: sorting.sortColumn,
Operation: "Order By",
"Field Value": sorting.sortOrder,
},
]
}
return filterDisplayConfig
}
const displaySchema = { const displaySchema = {
Field: { Field: {
type: "string", type: "string",