From 5cd69e8d39ba94f436db47cd7e6a5c9d94da1be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Fri, 10 May 2019 12:10:32 +0200 Subject: [PATCH] Explore: Fixes zoom exception in Loki/Graph (#16991) Fixes: #16986 (cherry picked from commit d5a35f3631a46f513d7c4cd3b94f68060c9c5d77) --- public/app/features/explore/Explore.tsx | 1 - public/app/features/explore/LogsContainer.tsx | 20 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index b5863a27457..67d7cb9f578 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -275,7 +275,6 @@ export class Explore extends React.PureComponent { void; onClickLabel: (key: string, value: string) => void; onStartScanning: () => void; onStopScanning: () => void; @@ -35,9 +34,20 @@ interface LogsContainerProps { dedupStrategy: LogsDedupStrategy; hiddenLogLevels: Set; width: number; + changeTime: typeof changeTime; } export class LogsContainer extends PureComponent { + onChangeTime = (absRange: AbsoluteTimeRange) => { + const { exploreId, timeZone, changeTime } = this.props; + const range = { + from: timeZone.isUtc ? toUtc(absRange.from) : dateTime(absRange.from), + to: timeZone.isUtc ? toUtc(absRange.to) : dateTime(absRange.to), + }; + + changeTime(exploreId, range); + }; + onClickLogsButton = () => { this.props.toggleLogs(this.props.exploreId, this.props.showingLogs); }; @@ -61,7 +71,6 @@ export class LogsContainer extends PureComponent { logsHighlighterExpressions, logsResult, dedupedResult, - onChangeTime, onClickLabel, onStartScanning, onStopScanning, @@ -83,7 +92,7 @@ export class LogsContainer extends PureComponent { exploreId={exploreId} highlighterExpressions={logsHighlighterExpressions} loading={loading} - onChangeTime={onChangeTime} + onChangeTime={this.onChangeTime} onClickLabel={onClickLabel} onStartScanning={onStartScanning} onStopScanning={onStopScanning} @@ -130,6 +139,7 @@ const mapDispatchToProps = { toggleLogs, changeDedupStrategy, toggleLogLevelAction, + changeTime, }; export default hot(module)(