mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[FIX] Allow filters without index (#68225)
* Allow filters without index * Explicitly return true from isFilterApplicable id no index patterns were provided * Adjust test result
This commit is contained in:
parent
edc4d58e12
commit
537d2f2de1
3 changed files with 10 additions and 1 deletions
|
@ -74,7 +74,8 @@ export function FilterItem(props: Props) {
|
|||
setIndexPatternExists(false);
|
||||
});
|
||||
} else {
|
||||
setIndexPatternExists(false);
|
||||
// Allow filters without an index pattern and don't validate them.
|
||||
setIndexPatternExists(true);
|
||||
}
|
||||
}, [props.filter.meta.index]);
|
||||
|
||||
|
@ -244,6 +245,9 @@ export function FilterItem(props: Props) {
|
|||
* This function makes this behavior explicit, but it needs to be revised.
|
||||
*/
|
||||
function isFilterApplicable() {
|
||||
// Any filter is applicable if no index patterns were provided to FilterBar.
|
||||
if (!props.indexPatterns.length) return true;
|
||||
|
||||
const ip = getIndexPatternFromFilter(filter, indexPatterns);
|
||||
if (ip) return true;
|
||||
|
||||
|
|
|
@ -217,6 +217,11 @@ export default function ({ getService, getPageObjects }) {
|
|||
const hasWarningFieldFilter = await filterBar.hasFilter('extension', 'warn', true);
|
||||
expect(hasWarningFieldFilter).to.be(true);
|
||||
});
|
||||
|
||||
it('filter without an index pattern is rendred as a warning, if the dashboard has an index pattern', async function () {
|
||||
const noIndexPatternFilter = await filterBar.hasFilter('banana', 'warn', true);
|
||||
expect(noIndexPatternFilter).to.be(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue