Skip to content

Commit

Permalink
fix: added in & not in operator in filter
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Jan 30, 2024
1 parent 26f0592 commit 5a73682
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions frontend/src/components/Filter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ function getOperators(fieldtype, fieldname) {
{ label: 'Not Equals', value: 'not equals' },
{ label: 'Like', value: 'like' },
{ label: 'Not Like', value: 'not like' },
{ label: 'In', value: 'in' },
{ label: 'Not In', value: 'not in' },
{ label: 'Is', value: 'is' },
]
)
Expand All @@ -215,13 +217,17 @@ function getOperators(fieldtype, fieldname) {
if (typeNumber.includes(fieldtype)) {
options.push(
...[
{ label: 'Equals', value: 'equals' },
{ label: 'Not Equals', value: 'not equals' },
{ label: 'Like', value: 'like' },
{ label: 'Not Like', value: 'not like' },
{ label: 'In', value: 'in' },
{ label: 'Not In', value: 'not in' },
{ label: 'Is', value: 'is' },
{ label: '<', value: '<' },
{ label: '>', value: '>' },
{ label: '<=', value: '<=' },
{ label: '>=', value: '>=' },
{ label: 'Equals', value: 'equals' },
{ label: 'Not Equals', value: 'not equals' },
{ label: 'Is', value: 'is' },
]
)
}
Expand All @@ -230,6 +236,8 @@ function getOperators(fieldtype, fieldname) {
...[
{ label: 'Equals', value: 'equals' },
{ label: 'Not Equals', value: 'not equals' },
{ label: 'In', value: 'in' },
{ label: 'Not In', value: 'not in' },
{ label: 'Is', value: 'is' },
]
)
Expand All @@ -239,9 +247,11 @@ function getOperators(fieldtype, fieldname) {
...[
{ label: 'Equals', value: 'equals' },
{ label: 'Not Equals', value: 'not equals' },
{ label: 'Is', value: 'is' },
{ label: 'Like', value: 'like' },
{ label: 'Not Like', value: 'not like' },
{ label: 'In', value: 'in' },
{ label: 'Not In', value: 'not in' },
{ label: 'Is', value: 'is' },
]
)
}
Expand All @@ -253,6 +263,8 @@ function getOperators(fieldtype, fieldname) {
...[
{ label: 'Like', value: 'like' },
{ label: 'Not Like', value: 'not like' },
{ label: 'In', value: 'in' },
{ label: 'Not In', value: 'not in' },
{ label: 'Is', value: 'is' },
]
)
Expand Down Expand Up @@ -295,7 +307,7 @@ function getValSelect(f) {
type: 'select',
options: timespanOptions,
})
} else if (operator == 'like') {
} else if (['like', 'not like', 'in', 'not in'].includes(operator)) {
return h(FormControl, { type: 'text' })
} else if (typeSelect.includes(fieldtype) || typeCheck.includes(fieldtype)) {
const _options =
Expand Down Expand Up @@ -422,6 +434,8 @@ function isSameTypeOperator(oldOperator, newOperator) {
'not like',
'equals',
'not equals',
'in',
'not in',
'>',
'<',
'>=',
Expand Down Expand Up @@ -472,6 +486,8 @@ function transformIn(f) {
const operatorMap = {
is: 'is',
'is not': 'is not',
in: 'in',
'not in': 'not in',
equals: '=',
'not equals': '!=',
yes: true,
Expand All @@ -496,6 +512,8 @@ const oppositeOperatorMap = {
false: 'no',
LIKE: 'like',
'NOT LIKE': 'not like',
in: 'in',
'not in': 'not in',
'>': '>',
'<': '<',
'>=': '>=',
Expand Down

0 comments on commit 5a73682

Please sign in to comment.