Skip to content

Commit

Permalink
[8.14] [ML] Single Metric Viewer: ensures chart displays correctly wh…
Browse files Browse the repository at this point in the history
…en opening from a job annotation (#182176) (#182277)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[ML] Single Metric Viewer: ensures chart displays correctly when
opening from a job annotation
(#182176)](#182176)

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

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

<!--BACKPORT [{"author":{"name":"Melissa
Alvarez","email":"melissa.alvarez@elastic.co"},"sourceCommit":{"committedDate":"2024-05-01T17:29:28Z","message":"[ML]
Single Metric Viewer: ensures chart displays correctly when opening from
a job annotation (#182176)\n\n## Summary\r\n\r\nFixes
#181910 the
position of the zoom slider gets set correctly when user\r\nnavigates to
the single metric viewer from the anomaly explorer page or\r\njobs list
from annotations -> job model snapshots -> single
metric\r\nviewer.\r\n\r\nThis PR removes the previous forecast id
comparison as it was never\r\ngetting correctly set so the `focusRange`
was getting reset even when it\r\nshould not have been because it was
already defined.\r\n\r\nI believe this was introduced
in\r\nhttps://github.com//pull/176969.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/cbd297ae-e3c2-43ab-ad06-27898ea06a3a\r\n\r\nConfirming
the link with forecast id still works as
expected:\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/9216c880-7bcf-4d46-b071-adb77f2db1e4\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\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\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a1b990ddd6a58519ecf6da55260de22c21aa0055","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Anomaly
Detection","v8.14.0","v8.15.0"],"title":"[ML] Single Metric Viewer:
ensures chart displays correctly when opening from a job
annotation","number":182176,"url":"#182176
Single Metric Viewer: ensures chart displays correctly when opening from
a job annotation (#182176)\n\n## Summary\r\n\r\nFixes
#181910 the
position of the zoom slider gets set correctly when user\r\nnavigates to
the single metric viewer from the anomaly explorer page or\r\njobs list
from annotations -> job model snapshots -> single
metric\r\nviewer.\r\n\r\nThis PR removes the previous forecast id
comparison as it was never\r\ngetting correctly set so the `focusRange`
was getting reset even when it\r\nshould not have been because it was
already defined.\r\n\r\nI believe this was introduced
in\r\nhttps://github.com//pull/176969.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/cbd297ae-e3c2-43ab-ad06-27898ea06a3a\r\n\r\nConfirming
the link with forecast id still works as
expected:\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/9216c880-7bcf-4d46-b071-adb77f2db1e4\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\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\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a1b990ddd6a58519ecf6da55260de22c21aa0055"}},"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":"#182176
Single Metric Viewer: ensures chart displays correctly when opening from
a job annotation (#182176)\n\n## Summary\r\n\r\nFixes
#181910 the
position of the zoom slider gets set correctly when user\r\nnavigates to
the single metric viewer from the anomaly explorer page or\r\njobs list
from annotations -> job model snapshots -> single
metric\r\nviewer.\r\n\r\nThis PR removes the previous forecast id
comparison as it was never\r\ngetting correctly set so the `focusRange`
was getting reset even when it\r\nshould not have been because it was
already defined.\r\n\r\nI believe this was introduced
in\r\nhttps://github.com//pull/176969.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/cbd297ae-e3c2-43ab-ad06-27898ea06a3a\r\n\r\nConfirming
the link with forecast id still works as
expected:\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/6446462/9216c880-7bcf-4d46-b071-adb77f2db1e4\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\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\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"a1b990ddd6a58519ecf6da55260de22c21aa0055"}}]}]
BACKPORT-->

Co-authored-by: Melissa Alvarez <melissa.alvarez@elastic.co>
  • Loading branch information
kibanamachine and alvarezmelissa87 committed May 1, 2024
1 parent 7548b2f commit e8003b2
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ export class TimeSeriesExplorer extends React.Component {
if (
// If the user's focus range is not defined (i.e. no 'zoom' parameter restored from the appState URL),
// then calculate the default focus range to use
zoom === undefined &&
(focusRange === undefined ||
this.previousSelectedForecastId !== this.props.selectedForecastId)
zoom === undefined ||
focusRange === undefined
) {
focusRange = this.mlTimeSeriesExplorer.calculateDefaultFocusRange(
autoZoomDuration,
Expand All @@ -476,10 +475,12 @@ export class TimeSeriesExplorer extends React.Component {
this.previousSelectedForecastId = this.props.selectedForecastId;
}

this.contextChartSelected({
from: focusRange[0],
to: focusRange[1],
});
if (focusRange !== undefined) {
this.contextChartSelected({
from: focusRange[0],
to: focusRange[1],
});
}
}

this.setState(stateUpdate);
Expand Down

0 comments on commit e8003b2

Please sign in to comment.