Add NOT prefix to negated filter with custom label (#35521)

Negated filters disregarded the "NOT" when using custom labels. Therefore it was not possible to differentiate between the 2 filter states.  This fix for #34979 adds the "NOT" also to custom labels
This commit is contained in:
Matthias Wilhelm 2019-04-24 18:01:54 +02:00 committed by GitHub
parent 1794c8b01c
commit 73c3492035
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,16 +72,16 @@ export const FilterView: SFC<Props> = ({ filter, ...rest }: Props) => {
};
export function getFilterDisplayText(filter: Filter) {
if (filter.meta.alias !== null) {
return filter.meta.alias;
}
const prefix = filter.meta.negate
? ` ${i18n.translate('common.ui.filterBar.negatedFilterPrefix', {
defaultMessage: 'NOT ',
})}`
: '';
if (filter.meta.alias !== null) {
return `${prefix}${filter.meta.alias}`;
}
switch (filter.meta.type) {
case 'exists':
return `${prefix}${filter.meta.key} ${existsOperator.message}`;