Skip to content

Commit

Permalink
[ML] Fixes position of Single Metric zoom when at start of range (#40854
Browse files Browse the repository at this point in the history
)
  • Loading branch information
peteharverson authored Jul 11, 2019
1 parent fe36fad commit 1c3ae8e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -935,14 +935,14 @@ module.controller('MlTimeSeriesExplorerController', function (
$scope.autoZoomDuration = getAutoZoomDuration();

// Check that the zoom times are valid.
// zoomFrom must be at or after dashboard earliest,
// zoomTo must be at or before dashboard latest plus context chart agg interval.
// zoomFrom must be at or after context chart search bounds earliest,
// zoomTo must be at or before context chart search bounds latest.
const zoomFrom = moment(zoomState.from, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
const zoomTo = moment(zoomState.to, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
const aggIntervalMs = $scope.contextAggregationInterval.asMilliseconds();
const bounds = timefilter.getActiveBounds();
const earliest = bounds.min;
const latest = moment(bounds.max).add(aggIntervalMs, 'ms');
const searchBounds = getBoundsRoundedToInterval(bounds, $scope.contextAggregationInterval, true);
const earliest = searchBounds.min;
const latest = searchBounds.max;

if (zoomFrom.isValid() && zoomTo.isValid &&
zoomTo.isAfter(zoomFrom) &&
Expand Down

0 comments on commit 1c3ae8e

Please sign in to comment.