From f0f06f887f6b18fe33a2a4ea1b672b95bc1eff84 Mon Sep 17 00:00:00 2001 From: Jade McGough Date: Wed, 1 Feb 2017 10:05:26 -0800 Subject: [PATCH] simplify dashboard code --- ui/src/dashboards/containers/DashboardPage.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js index 2ea4894ed..1ff9b4efe 100644 --- a/ui/src/dashboards/containers/DashboardPage.js +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -32,17 +32,12 @@ const DashboardPage = React.createClass({ getSource(this.props.params.sourceID).then(({data: source}) => { this.setState({ dashboards: resp.data.dashboards, - dashboard: this.currentDashboard(resp.data.dashboards, this.props.params.dashboardID), source, }); }); }); }, - componentWillReceiveProps(nextProps) { - this.setState({dashboard: this.currentDashboard(this.state.dashboards, nextProps.params.dashboardID)}); - }, - currentDashboard(dashboards, dashboardID) { return _.find(dashboards, (d) => d.id.toString() === dashboardID); }, @@ -86,9 +81,8 @@ const DashboardPage = React.createClass({ }, render() { - const {dashboards, dashboard, timeRange} = this.state; - - const dashboardName = dashboard ? dashboard.name : ''; + const {dashboards, timeRange} = this.state; + const dashboard = this.currentDashboard(dashboards, this.props.params.dashboardID) return (
@@ -97,7 +91,7 @@ const DashboardPage = React.createClass({