Support legacy custom field filters
This commit is contained in:
parent
c223090180
commit
03fec3fa3e
@ -62,7 +62,6 @@ import {
|
|||||||
FILTER_HAS_CUSTOM_FIELDS_ANY,
|
FILTER_HAS_CUSTOM_FIELDS_ANY,
|
||||||
FILTER_HAS_CUSTOM_FIELDS_ALL,
|
FILTER_HAS_CUSTOM_FIELDS_ALL,
|
||||||
FILTER_HAS_ANY_CUSTOM_FIELDS,
|
FILTER_HAS_ANY_CUSTOM_FIELDS,
|
||||||
FILTER_DOES_NOT_HAVE_CUSTOM_FIELDS,
|
|
||||||
FILTER_CUSTOM_FIELDS_LOOKUP,
|
FILTER_CUSTOM_FIELDS_LOOKUP,
|
||||||
} from 'src/app/data/filter-rule-type'
|
} from 'src/app/data/filter-rule-type'
|
||||||
import {
|
import {
|
||||||
@ -96,6 +95,7 @@ import { SearchService } from 'src/app/services/rest/search.service'
|
|||||||
import {
|
import {
|
||||||
CustomFieldQueryExpression,
|
CustomFieldQueryExpression,
|
||||||
CustomFieldQueryAtom,
|
CustomFieldQueryAtom,
|
||||||
|
CustomFieldQueryLogicalOperator,
|
||||||
} from 'src/app/data/custom-field-query'
|
} from 'src/app/data/custom-field-query'
|
||||||
import { CustomFieldQueriesModel } from '../../common/custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
import { CustomFieldQueriesModel } from '../../common/custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
||||||
|
|
||||||
@ -231,6 +231,11 @@ export class FilterEditorComponent
|
|||||||
return $localize`Without any tag`
|
return $localize`Without any tag`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FILTER_HAS_CUSTOM_FIELDS_ANY:
|
||||||
|
return $localize`Custom fields include: ${this.customFields.find(
|
||||||
|
(f) => f.id == +rule.value
|
||||||
|
)?.name}`
|
||||||
|
|
||||||
case FILTER_HAS_CUSTOM_FIELDS_ALL:
|
case FILTER_HAS_CUSTOM_FIELDS_ALL:
|
||||||
return $localize`Custom fields: ${
|
return $localize`Custom fields: ${
|
||||||
this.customFields.find((f) => f.id == +rule.value)?.name
|
this.customFields.find((f) => f.id == +rule.value)?.name
|
||||||
@ -546,9 +551,26 @@ export class FilterEditorComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// TODO: handle error?
|
// error handled by list view service
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
// Legacy custom field filters
|
||||||
|
case FILTER_HAS_CUSTOM_FIELDS_ALL:
|
||||||
|
this.customFieldQueriesModel.addExpression(
|
||||||
|
new CustomFieldQueryExpression([
|
||||||
|
CustomFieldQueryLogicalOperator.And,
|
||||||
|
rule.value.split(','),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
break
|
||||||
|
case FILTER_HAS_CUSTOM_FIELDS_ANY:
|
||||||
|
this.customFieldQueriesModel.addExpression(
|
||||||
|
new CustomFieldQueryExpression([
|
||||||
|
CustomFieldQueryLogicalOperator.Or,
|
||||||
|
rule.value.split(','),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
break
|
||||||
case FILTER_ASN_ISNULL:
|
case FILTER_ASN_ISNULL:
|
||||||
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||||
this.textFilterModifier =
|
this.textFilterModifier =
|
||||||
@ -773,7 +795,6 @@ export class FilterEditorComponent
|
|||||||
value: JSON.stringify(queries[0]),
|
value: JSON.stringify(queries[0]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// TODO: fully implement custom fields
|
|
||||||
if (this.dateCreatedBefore) {
|
if (this.dateCreatedBefore) {
|
||||||
filterRules.push({
|
filterRules.push({
|
||||||
rule_type: FILTER_CREATED_BEFORE,
|
rule_type: FILTER_CREATED_BEFORE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user