mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -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]).toHaveProperty('name', 'kibanaFilter');
|
||||||
expect(actual[0].functions[0].arguments).toMatchInlineSnapshot(`
|
expect(actual[0].functions[0].arguments).toMatchInlineSnapshot(`
|
||||||
Object {
|
Object {
|
||||||
|
"disabled": Array [
|
||||||
|
false,
|
||||||
|
],
|
||||||
"negate": Array [
|
"negate": Array [
|
||||||
false,
|
false,
|
||||||
],
|
],
|
||||||
|
@ -35,6 +38,9 @@ describe('interpreter/functions#filtersToAst', () => {
|
||||||
expect(actual[1].functions[0]).toHaveProperty('name', 'kibanaFilter');
|
expect(actual[1].functions[0]).toHaveProperty('name', 'kibanaFilter');
|
||||||
expect(actual[1].functions[0].arguments).toMatchInlineSnapshot(`
|
expect(actual[1].functions[0].arguments).toMatchInlineSnapshot(`
|
||||||
Object {
|
Object {
|
||||||
|
"disabled": Array [
|
||||||
|
false,
|
||||||
|
],
|
||||||
"negate": Array [
|
"negate": Array [
|
||||||
true,
|
true,
|
||||||
],
|
],
|
||||||
|
|
|
@ -17,6 +17,7 @@ export const filtersToAst = (filters: Filter[] | Filter) => {
|
||||||
buildExpressionFunction<ExpressionFunctionKibanaFilter>('kibanaFilter', {
|
buildExpressionFunction<ExpressionFunctionKibanaFilter>('kibanaFilter', {
|
||||||
query: JSON.stringify(restOfFilter),
|
query: JSON.stringify(restOfFilter),
|
||||||
negate: filter.meta.negate,
|
negate: filter.meta.negate,
|
||||||
|
disabled: filter.meta.disabled,
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { KibanaFilter } from './kibana_context_type';
|
||||||
interface Arguments {
|
interface Arguments {
|
||||||
query: string;
|
query: string;
|
||||||
negate?: boolean;
|
negate?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExpressionFunctionKibanaFilter = ExpressionFunctionDefinition<
|
export type ExpressionFunctionKibanaFilter = ExpressionFunctionDefinition<
|
||||||
|
@ -45,6 +46,13 @@ export const kibanaFilterFunction: ExpressionFunctionKibanaFilter = {
|
||||||
defaultMessage: 'Should the filter be negated',
|
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) {
|
fn(input, args) {
|
||||||
|
@ -53,7 +61,7 @@ export const kibanaFilterFunction: ExpressionFunctionKibanaFilter = {
|
||||||
meta: {
|
meta: {
|
||||||
negate: args.negate || false,
|
negate: args.negate || false,
|
||||||
alias: '',
|
alias: '',
|
||||||
disabled: false,
|
disabled: args.disabled || false,
|
||||||
},
|
},
|
||||||
...JSON.parse(args.query),
|
...JSON.parse(args.query),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue