Skip to content

Commit

Permalink
[8.14] [ML] AIOps: Fix query string for the metric chart (#181314) (#…
Browse files Browse the repository at this point in the history
…181549)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[ML] AIOps: Fix query string for the metric chart
(#181314)](#181314)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-04-24T11:55:03Z","message":"[ML]
AIOps: Fix query string for the metric chart (#181314)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/179814\r\n\r\nQuery string from
the Unified Search query bar was applying to the\r\nchange point agg
request, but wasn't in sync with the query service to\r\ncorrectly
render the chart preview. With the PR the query string
is\r\nsynchronized and metric charts are rendered
correctly.\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"2bd49f5ae4816c75a87a371e58ca2b7ea73d4bd4","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:ML","Feature:ML/AIOps","v8.14.0","v8.15.0"],"title":"[ML]
AIOps: Fix query string for the metric chart
","number":181314,"url":"https://github.com/elastic/kibana/pull/181314","mergeCommit":{"message":"[ML]
AIOps: Fix query string for the metric chart (#181314)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/179814\r\n\r\nQuery string from
the Unified Search query bar was applying to the\r\nchange point agg
request, but wasn't in sync with the query service to\r\ncorrectly
render the chart preview. With the PR the query string
is\r\nsynchronized and metric charts are rendered
correctly.\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"2bd49f5ae4816c75a87a371e58ca2b7ea73d4bd4"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/181314","number":181314,"mergeCommit":{"message":"[ML]
AIOps: Fix query string for the metric chart (#181314)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/179814\r\n\r\nQuery string from
the Unified Search query bar was applying to the\r\nchange point agg
request, but wasn't in sync with the query service to\r\ncorrectly
render the chart preview. With the PR the query string
is\r\nsynchronized and metric charts are rendered
correctly.\r\n\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"2bd49f5ae4816c75a87a371e58ca2b7ea73d4bd4"}}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <[email protected]>
  • Loading branch information
kibanamachine and darnautov authored Apr 24, 2024
1 parent c9ce4fe commit 9670c1c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const ChangePointDetectionContextProvider: FC = ({ children }) => {
const {
uiSettings,
data: {
query: { filterManager },
query: { filterManager, queryString },
},
} = useAiopsAppContext();

Expand Down Expand Up @@ -241,11 +241,18 @@ export const ChangePointDetectionContextProvider: FC = ({ children }) => {
if (requestParamsFromUrl.filters) {
filterManager.setFilters(requestParamsFromUrl.filters);
}
if (requestParamsFromUrl.query) {
queryString.setQuery(requestParamsFromUrl.query);
}
if (globalFilters) {
filterManager?.addFilters(globalFilters);
}
return () => {
filterManager?.removeAll();
queryString.clearQuery();
};
},
[requestParamsFromUrl.filters, filterManager]
[requestParamsFromUrl.filters, requestParamsFromUrl.query, filterManager, queryString]
);

const combinedQuery = useMemo(() => {
Expand Down

0 comments on commit 9670c1c

Please sign in to comment.