[9.0] fix(slo): search bar filters (#217702) (#217867)

# Backport

This will backport the following commits from `main` to `9.0`:
- [fix(slo): search bar filters
(#217702)](https://github.com/elastic/kibana/pull/217702)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Kevin
Delemme","email":"kevin.delemme@elastic.co"},"sourceCommit":{"committedDate":"2025-04-09T16:49:54Z","message":"fix(slo):
search bar filters
(#217702)","sha":"b6de659199f15998234af851f63589b49f2e4827","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1","v8.17.5"],"title":"fix(slo):
search bar
filters","number":217702,"url":"https://github.com/elastic/kibana/pull/217702","mergeCommit":{"message":"fix(slo):
search bar filters
(#217702)","sha":"b6de659199f15998234af851f63589b49f2e4827"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217702","number":217702,"mergeCommit":{"message":"fix(slo):
search bar filters
(#217702)","sha":"b6de659199f15998234af851f63589b49f2e4827"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
This commit is contained in:
Kevin Delemme 2025-04-10 12:41:34 -04:00 committed by GitHub
parent e4cf5bc1cf
commit d3933fb7e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,12 @@ export const QuerySearchBar = memo(
range: TimeRange;
setRange: (range: TimeRange) => void;
}) => {
const { SearchBar } = useKibana().services.unifiedSearch.ui;
const {
unifiedSearch: {
ui: { SearchBar },
},
data: dataService,
} = useKibana().services;
const { control } = useFormContext<CreateSLOForm>();
@ -129,6 +134,8 @@ export const QuerySearchBar = memo(
};
});
dataService.query.filterManager.setFilters(updatedFilters);
if (kqlQuerySchema.is(field.value)) {
field.onChange({
filters: updatedFilters,