From d53a430c8276cd97590828acf909caf2cdb01f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 29 Jan 2019 14:58:57 +0100 Subject: [PATCH] Fixed issue with explore changeTime redux action not being hooked up, fixes #15115 --- public/app/features/explore/GraphContainer.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/public/app/features/explore/GraphContainer.tsx b/public/app/features/explore/GraphContainer.tsx index c3a92f4007e..7263fd09288 100644 --- a/public/app/features/explore/GraphContainer.tsx +++ b/public/app/features/explore/GraphContainer.tsx @@ -1,17 +1,16 @@ import React, { PureComponent } from 'react'; import { hot } from 'react-hot-loader'; import { connect } from 'react-redux'; -import { RawTimeRange, TimeRange } from '@grafana/ui'; +import { TimeRange, RawTimeRange } from '@grafana/ui'; import { ExploreId, ExploreItemState } from 'app/types/explore'; import { StoreState } from 'app/types'; -import { toggleGraph } from './state/actions'; +import { toggleGraph, changeTime } from './state/actions'; import Graph from './Graph'; import Panel from './Panel'; interface GraphContainerProps { - onChangeTime: (range: TimeRange) => void; exploreId: ExploreId; graphResult?: any[]; loading: boolean; @@ -20,6 +19,7 @@ interface GraphContainerProps { showingTable: boolean; split: boolean; toggleGraph: typeof toggleGraph; + changeTime: typeof changeTime; } export class GraphContainer extends PureComponent { @@ -27,8 +27,12 @@ export class GraphContainer extends PureComponent { this.props.toggleGraph(this.props.exploreId); }; + onChangeTime = (timeRange: TimeRange) => { + this.props.changeTime(this.props.exploreId, timeRange); + }; + render() { - const { exploreId, graphResult, loading, onChangeTime, showingGraph, showingTable, range, split } = this.props; + const { exploreId, graphResult, loading, showingGraph, showingTable, range, split } = this.props; const graphHeight = showingGraph && showingTable ? '200px' : '400px'; if (!graphResult) { @@ -41,7 +45,7 @@ export class GraphContainer extends PureComponent { data={graphResult} height={graphHeight} id={`explore-graph-${exploreId}`} - onChangeTime={onChangeTime} + onChangeTime={this.onChangeTime} range={range} split={split} /> @@ -61,6 +65,7 @@ function mapStateToProps(state: StoreState, { exploreId }) { const mapDispatchToProps = { toggleGraph, + changeTime, }; export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(GraphContainer));