[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs#259517
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
...latform/plugins/shared/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx
Outdated
Show resolved
Hide resolved
...latform/plugins/shared/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx
Outdated
Show resolved
Hide resolved
...latform/plugins/shared/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx
Outdated
Show resolved
Hide resolved
src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx
Outdated
Show resolved
Hide resolved
src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx
Outdated
Show resolved
Hide resolved
src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx
Outdated
Show resolved
Hide resolved
| @@ -346,12 +346,10 @@ export class SearchBarUI<QT extends (Query | AggregateQuery) | Query = Query> ex | |||
| } | |||
|
|
|||
| private shouldRenderFilterBar() { | |||
There was a problem hiding this comment.
How about just return this.props.showFilterBar || this.props.filters.length?
Really you are just removing indexPatterns length check.
There was a problem hiding this comment.
it works with &&: return this.props.showFilterBar && this.props.filters
There was a problem hiding this comment.
updated the pr
There was a problem hiding this comment.
I don't think return this.props.showFilterBar && this.props.filters is correct. This will return false when this.props.filters is not provided.
Taking a step back, we want to render filter bar whenever this.props.showFilterBar is true regardless of available indexPatterns. In that case. I think we should remove shouldRenderFilterBar helper function and just replace its usage with this.props.showFilterBar
There was a problem hiding this comment.
Hi @nreese I've addressed the requested changes to remove shouldRenderFilterBar function and to use this.props.showFilterBar instead.
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
Unknown metric groupsReferences to deprecated APIs
Unreferenced deprecated APIs
History
|
|
Starting backport for target branches: 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/23948182226 |
|
Starting backport for target branches: 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/23948182217 |
…ws error on create/edit MWs (elastic#259517) Closes elastic#259514 ## Summary Fix crash in FilterEditor when submitting a Query DSL filter with no index patterns available. getFilterFromQueryDsl accessed indexPatterns[0].id without guarding against an empty array. - fixed also: filter not being displayed after creation, two separate guards were preventing DSL filter pills from rendering in Maintenance Windows (where indexPatterns / dataViews is an empty array): - fixed also edit added filter: indexPattern?.getName() fails because getName() is a method on the DataView class, not on plain DataViewBase objects. Fixed by using optional call getName?.() with fallbacks to name and title. Related to: elastic#256622 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit f6c8369)
…ws error on create/edit MWs (elastic#259517) Closes elastic#259514 ## Summary Fix crash in FilterEditor when submitting a Query DSL filter with no index patterns available. getFilterFromQueryDsl accessed indexPatterns[0].id without guarding against an empty array. - fixed also: filter not being displayed after creation, two separate guards were preventing DSL filter pills from rendering in Maintenance Windows (where indexPatterns / dataViews is an empty array): - fixed also edit added filter: indexPattern?.getName() fails because getName() is a method on the DataView class, not on plain DataViewBase objects. Fixed by using optional call getName?.() with fallbacks to name and title. Related to: elastic#256622 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit f6c8369)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ws error on create/edit MWs (elastic#259517) Closes elastic#259514 ## Summary Fix crash in FilterEditor when submitting a Query DSL filter with no index patterns available. getFilterFromQueryDsl accessed indexPatterns[0].id without guarding against an empty array. - fixed also: filter not being displayed after creation, two separate guards were preventing DSL filter pills from rendering in Maintenance Windows (where indexPatterns / dataViews is an empty array): - fixed also edit added filter: indexPattern?.getName() fails because getName() is a method on the DataView class, not on plain DataViewBase objects. Fixed by using optional call getName?.() with fallbacks to name and title. Related to: elastic#256622 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit f6c8369)
…ws error on create/edit MWs (elastic#259517) Closes elastic#259514 ## Summary Fix crash in FilterEditor when submitting a Query DSL filter with no index patterns available. getFilterFromQueryDsl accessed indexPatterns[0].id without guarding against an empty array. - fixed also: filter not being displayed after creation, two separate guards were preventing DSL filter pills from rendering in Maintenance Windows (where indexPatterns / dataViews is an empty array): - fixed also edit added filter: indexPattern?.getName() fails because getName() is a method on the DataView class, not on plain DataViewBase objects. Fixed by using optional call getName?.() with fallbacks to name and title. Related to: elastic#256622 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit f6c8369)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…r throws error on create/edit MWs (#259517) (#261139) # Backport This will backport the following commits from `main` to `9.3`: - [[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)](#259517) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Georgiana-Andreea Onoleață","email":"georgiana.onoleata@elastic.co"},"sourceCommit":{"committedDate":"2026-04-03T09:43:16Z","message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","backport:version","v9.4.0","v9.3.3","v9.2.8"],"title":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs","number":259517,"url":"https://github.com/elastic/kibana/pull/259517","mergeCommit":{"message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/259517","number":259517,"mergeCommit":{"message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Georgiana-Andreea Onoleață <georgiana.onoleata@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…r throws error on create/edit MWs (#259517) (#261138) # Backport This will backport the following commits from `main` to `9.2`: - [[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)](#259517) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Georgiana-Andreea Onoleață","email":"georgiana.onoleata@elastic.co"},"sourceCommit":{"committedDate":"2026-04-03T09:43:16Z","message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","backport:version","v9.4.0","v9.3.3","v9.2.8"],"title":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs","number":259517,"url":"https://github.com/elastic/kibana/pull/259517","mergeCommit":{"message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/259517","number":259517,"mergeCommit":{"message":"[ResponseOps][MaintenanceWindow] Add filter button of DSL filter throws error on create/edit MWs (#259517)\n\nCloses https://github.com/elastic/kibana/issues/259514\n\n## Summary\n\nFix crash in FilterEditor when submitting a Query DSL filter with no\nindex patterns available. getFilterFromQueryDsl accessed\nindexPatterns[0].id without guarding against an empty array.\n- fixed also: filter not being displayed after creation, two separate\nguards were preventing DSL filter pills from rendering in Maintenance\nWindows (where indexPatterns / dataViews is an empty array):\n- fixed also edit added filter: indexPattern?.getName() fails because\ngetName() is a method on the DataView class, not on plain DataViewBase\nobjects. Fixed by using optional call getName?.() with fallbacks to name\nand title.\n\nRelated to: https://github.com/elastic/kibana/pull/256622\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"f6c836958dab7169a84f7c2ec19e2e758f823353"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Georgiana-Andreea Onoleață <georgiana.onoleata@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>


Closes #259514
Summary
Fix crash in FilterEditor when submitting a Query DSL filter with no index patterns available. getFilterFromQueryDsl accessed indexPatterns[0].id without guarding against an empty array.
Related to: #256622