From 60de0803253ca0d37b355f6b317426e78d584ad2 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 22 Feb 2018 12:25:23 -0800 Subject: [PATCH] change preventLoad to notInView for readibility Co-authored-by: Deniz Kusefoglu --- ui/src/dashboards/components/Dashboard.js | 2 +- ui/src/shared/components/AutoRefresh.js | 18 +++++++++--------- ui/src/shared/components/Layout.js | 2 +- ui/src/shared/components/RefreshingGraph.js | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ui/src/dashboards/components/Dashboard.js b/ui/src/dashboards/components/Dashboard.js index b262682db..cb1d3fee7 100644 --- a/ui/src/dashboards/components/Dashboard.js +++ b/ui/src/dashboards/components/Dashboard.js @@ -29,7 +29,7 @@ const Dashboard = ({ const cells = dashboard.cells.map(cell => { const dashboardCell = { ...cell, - preventLoad: !inView(cell), + notInView: !inView(cell), } dashboardCell.queries = dashboardCell.queries.map(q => ({ ...q, diff --git a/ui/src/shared/components/AutoRefresh.js b/ui/src/shared/components/AutoRefresh.js index c1a0abda5..ab124399d 100644 --- a/ui/src/shared/components/AutoRefresh.js +++ b/ui/src/shared/components/AutoRefresh.js @@ -27,9 +27,9 @@ const AutoRefresh = ComposedComponent => { } componentWillReceiveProps(nextProps) { - const preventLoadDidUpdate = !_.isEqual( - this.props.preventLoad, - nextProps.preventLoad + const notInViewDidUpdate = !_.isEqual( + this.props.notInView, + nextProps.notInView ) const queriesDidUpdate = this.queryDifference( @@ -43,13 +43,13 @@ const AutoRefresh = ComposedComponent => { ) const shouldRefetch = - queriesDidUpdate || tempVarsDidUpdate || preventLoadDidUpdate + queriesDidUpdate || tempVarsDidUpdate || notInViewDidUpdate if (shouldRefetch) { this.executeQueries( nextProps.queries, nextProps.templates, - nextProps.preventLoad + nextProps.notInView ) } @@ -62,7 +62,7 @@ const AutoRefresh = ComposedComponent => { this.executeQueries( nextProps.queries, nextProps.templates, - nextProps.preventLoad + nextProps.notInView ), nextProps.autoRefresh ) @@ -82,11 +82,11 @@ const AutoRefresh = ComposedComponent => { executeQueries = async ( queries, templates = [], - preventLoad = this.props.preventLoad + notInView = this.props.notInView ) => { const {editQueryStatus, grabDataForDownload} = this.props const {resolution} = this.state - if (preventLoad) { + if (notInView) { return } if (!queries.length) { @@ -225,7 +225,7 @@ const AutoRefresh = ComposedComponent => { wrapper.propTypes = { children: element, autoRefresh: number.isRequired, - preventLoad: bool, + notInView: bool, templates: arrayOf( shape({ type: string.isRequired, diff --git a/ui/src/shared/components/Layout.js b/ui/src/shared/components/Layout.js index 2bb0f541b..9bb29f9e7 100644 --- a/ui/src/shared/components/Layout.js +++ b/ui/src/shared/components/Layout.js @@ -76,7 +76,7 @@ const Layout = ( ? :