Allow `is not` filter for goals + lint

not-goals
Adam Rutkowski 3 years ago
parent 6915dd5e78
commit 5bcd7fe814

@ -27,7 +27,7 @@ export const OPERATION_PREFIX = {
};
export function supportsIsNot(filterName) {
return !['goal', 'prop_key'].includes(filterName)
return !['prop_key'].includes(filterName)
}
export function isFreeChoiceFilter(filterName) {
@ -39,7 +39,7 @@ export function isFreeChoiceFilter(filterName) {
let NON_ESCAPED_PIPE_REGEX;
try {
NON_ESCAPED_PIPE_REGEX = new RegExp("(?<!\\\\)\\|", "g")
} catch(_e) {
} catch (_e) {
NON_ESCAPED_PIPE_REGEX = '|'
}
@ -66,19 +66,19 @@ export function parsePrefix(rawValue) {
.filter((clause) => !!clause)
.map((val) => val.replaceAll(ESCAPED_PIPE, '|'))
return {type, values}
return { type, values }
}
export function parseQueryPropsFilter(query) {
return Object.entries(query.filters['props']).map(([key, propVal]) => {
const {type, values} = parsePrefix(propVal)
const clauses = values.map(val => { return {value: val, label: val}})
const { type, values } = parsePrefix(propVal)
const clauses = values.map(val => { return { value: val, label: val } })
return { propKey: { label: key, value: key }, type, clauses }
})
}
export function parseQueryFilter(query, filter) {
const {type, values} = parsePrefix(query.filters[filter] || '')
const { type, values } = parsePrefix(query.filters[filter] || '')
let labels = values
@ -97,9 +97,9 @@ export function parseQueryFilter(query, filter) {
labels = rawLabel.split('|').filter(label => !!label)
}
const clauses = values.map((value, index) => { return {value, label: labels[index]}})
const clauses = values.map((value, index) => { return { value, label: labels[index] } })
return {type, clauses}
return { type, clauses }
}
export function formatFilterGroup(filterGroup) {

Loading…
Cancel
Save