diff --git a/packages/web/src/modals/SetFilterModal.svelte b/packages/web/src/modals/SetFilterModal.svelte index 0a6964a5e..bd109fb0a 100644 --- a/packages/web/src/modals/SetFilterModal.svelte +++ b/packages/web/src/modals/SetFilterModal.svelte @@ -9,12 +9,18 @@ import ModalBase from './ModalBase.svelte'; import { closeCurrentModal } from './modalTools'; import FormRadioGroupItem from '../forms/FormRadioGroupItem.svelte'; + import FormValues from '../forms/FormValues.svelte'; export let condition1; export let onFilter; export let filterType; + const hasOperand = condition => { + return condition != 'NULL' && condition != 'NOT NULL' && condition != 'EXISTS' && condition != 'NOT EXISTS'; + }; + const createTerm = (condition, value) => { + if (!hasOperand(condition)) return condition; if (!value) return null; if (filterType == 'string') return `${condition}"${value}"`; return `${condition}${value}`; @@ -43,7 +49,11 @@
- + + {#if hasOperand(values.condition1)} + + {/if} +
@@ -57,7 +67,11 @@
- + + {#if hasOperand(values.condition2)} + + {/if} +
diff --git a/packages/web/src/modals/SetFilterModal_Select.svelte b/packages/web/src/modals/SetFilterModal_Select.svelte index 33457b7e1..d2837fcf0 100644 --- a/packages/web/src/modals/SetFilterModal_Select.svelte +++ b/packages/web/src/modals/SetFilterModal_Select.svelte @@ -14,6 +14,8 @@ { value: '>', label: 'is greater' }, { value: '<=', label: 'is smaller or equal' }, { value: '>=', label: 'is greater or equal' }, + { value: 'NULL', label: 'is NULL' }, + { value: 'NOT NULL', label: 'is not NULL' }, ]; case 'string': return [ @@ -29,6 +31,8 @@ { value: '>', label: 'is greater' }, { value: '<=', label: 'is smaller or equal' }, { value: '>=', label: 'is greater or equal' }, + { value: 'NULL', label: 'is NULL' }, + { value: 'NOT NULL', label: 'is not NULL' }, ]; case 'datetime': return [ @@ -38,6 +42,8 @@ { value: '>', label: 'is after' }, { value: '<=', label: 'is before or equal' }, { value: '>=', label: 'is after or equal' }, + { value: 'NULL', label: 'is NULL' }, + { value: 'NOT NULL', label: 'is not NULL' }, ]; case 'mongo': return [ @@ -53,6 +59,8 @@ { value: '!^', label: 'does not begin with' }, { value: '$', label: 'ends with' }, { value: '!$', label: 'does not end with' }, + { value: 'EXISTS', label: 'field exists' }, + { value: 'NOT EXISTS', label: 'field does not exist' }, ]; case 'eval': return [ @@ -68,6 +76,8 @@ { value: '!^', label: 'does not begin with' }, { value: '$', label: 'ends with' }, { value: '!$', label: 'does not end with' }, + { value: 'NULL', label: 'is NULL' }, + { value: 'NOT NULL', label: 'is not NULL' }, ]; } }