mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Single Metric Viewer: ensures chart displays correctly when opening from a job annotation (#182176)
## Summary Fixes https://github.com/elastic/kibana/issues/181910 Ensures the position of the zoom slider gets set correctly when user navigates to the single metric viewer from the anomaly explorer page or jobs list from annotations -> job model snapshots -> single metric viewer. This PR removes the previous forecast id comparison as it was never getting correctly set so the `focusRange` was getting reset even when it should not have been because it was already defined. I believe this was introduced in https://github.com/elastic/kibana/pull/176969.cbd297ae
-e3c2-43ab-ad06-27898ea06a3a Confirming the link with forecast id still works as expected:9216c880
-7bcf-4d46-b071-adb77f2db1e4 ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
565a447a8b
commit
a1b990ddd6
1 changed files with 8 additions and 7 deletions
|
@ -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,
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue