mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
[Dashboard]: Fixes disabled viz filter is applied (#101859)
* Fixes filter is applied even if is disabled on a dashboard * Fix 18n problem Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
80b109f95c
commit
06aaa529d4
3 changed files with 16 additions and 1 deletions
|
@ -24,6 +24,9 @@ describe('interpreter/functions#filtersToAst', () => {
|
|||
expect(actual[0].functions[0]).toHaveProperty('name', 'kibanaFilter');
|
||||
expect(actual[0].functions[0].arguments).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"disabled": Array [
|
||||
false,
|
||||
],
|
||||
"negate": Array [
|
||||
false,
|
||||
],
|
||||
|
@ -35,6 +38,9 @@ describe('interpreter/functions#filtersToAst', () => {
|
|||
expect(actual[1].functions[0]).toHaveProperty('name', 'kibanaFilter');
|
||||
expect(actual[1].functions[0].arguments).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"disabled": Array [
|
||||
false,
|
||||
],
|
||||
"negate": Array [
|
||||
true,
|
||||
],
|
||||
|
|
|
@ -17,6 +17,7 @@ export const filtersToAst = (filters: Filter[] | Filter) => {
|
|||
buildExpressionFunction<ExpressionFunctionKibanaFilter>('kibanaFilter', {
|
||||
query: JSON.stringify(restOfFilter),
|
||||
negate: filter.meta.negate,
|
||||
disabled: filter.meta.disabled,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@ import { KibanaFilter } from './kibana_context_type';
|
|||
interface Arguments {
|
||||
query: string;
|
||||
negate?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export type ExpressionFunctionKibanaFilter = ExpressionFunctionDefinition<
|
||||
|
@ -45,6 +46,13 @@ export const kibanaFilterFunction: ExpressionFunctionKibanaFilter = {
|
|||
defaultMessage: 'Should the filter be negated',
|
||||
}),
|
||||
},
|
||||
disabled: {
|
||||
types: ['boolean'],
|
||||
default: false,
|
||||
help: i18n.translate('data.search.functions.kibanaFilter.disabled.help', {
|
||||
defaultMessage: 'Should the filter be disabled',
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
||||
fn(input, args) {
|
||||
|
@ -53,7 +61,7 @@ export const kibanaFilterFunction: ExpressionFunctionKibanaFilter = {
|
|||
meta: {
|
||||
negate: args.negate || false,
|
||||
alias: '',
|
||||
disabled: false,
|
||||
disabled: args.disabled || false,
|
||||
},
|
||||
...JSON.parse(args.query),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue