change preventLoad to notInView for readibility

Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
pull/2837/head
Iris Scholten 2018-02-22 12:25:23 -08:00
parent ebfec71deb
commit 60de080325
4 changed files with 15 additions and 15 deletions

View File

@ -29,7 +29,7 @@ const Dashboard = ({
const cells = dashboard.cells.map(cell => { const cells = dashboard.cells.map(cell => {
const dashboardCell = { const dashboardCell = {
...cell, ...cell,
preventLoad: !inView(cell), notInView: !inView(cell),
} }
dashboardCell.queries = dashboardCell.queries.map(q => ({ dashboardCell.queries = dashboardCell.queries.map(q => ({
...q, ...q,

View File

@ -27,9 +27,9 @@ const AutoRefresh = ComposedComponent => {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const preventLoadDidUpdate = !_.isEqual( const notInViewDidUpdate = !_.isEqual(
this.props.preventLoad, this.props.notInView,
nextProps.preventLoad nextProps.notInView
) )
const queriesDidUpdate = this.queryDifference( const queriesDidUpdate = this.queryDifference(
@ -43,13 +43,13 @@ const AutoRefresh = ComposedComponent => {
) )
const shouldRefetch = const shouldRefetch =
queriesDidUpdate || tempVarsDidUpdate || preventLoadDidUpdate queriesDidUpdate || tempVarsDidUpdate || notInViewDidUpdate
if (shouldRefetch) { if (shouldRefetch) {
this.executeQueries( this.executeQueries(
nextProps.queries, nextProps.queries,
nextProps.templates, nextProps.templates,
nextProps.preventLoad nextProps.notInView
) )
} }
@ -62,7 +62,7 @@ const AutoRefresh = ComposedComponent => {
this.executeQueries( this.executeQueries(
nextProps.queries, nextProps.queries,
nextProps.templates, nextProps.templates,
nextProps.preventLoad nextProps.notInView
), ),
nextProps.autoRefresh nextProps.autoRefresh
) )
@ -82,11 +82,11 @@ const AutoRefresh = ComposedComponent => {
executeQueries = async ( executeQueries = async (
queries, queries,
templates = [], templates = [],
preventLoad = this.props.preventLoad notInView = this.props.notInView
) => { ) => {
const {editQueryStatus, grabDataForDownload} = this.props const {editQueryStatus, grabDataForDownload} = this.props
const {resolution} = this.state const {resolution} = this.state
if (preventLoad) { if (notInView) {
return return
} }
if (!queries.length) { if (!queries.length) {
@ -225,7 +225,7 @@ const AutoRefresh = ComposedComponent => {
wrapper.propTypes = { wrapper.propTypes = {
children: element, children: element,
autoRefresh: number.isRequired, autoRefresh: number.isRequired,
preventLoad: bool, notInView: bool,
templates: arrayOf( templates: arrayOf(
shape({ shape({
type: string.isRequired, type: string.isRequired,

View File

@ -76,7 +76,7 @@ const Layout = (
? <WidgetCell cell={cell} timeRange={timeRange} source={source} /> ? <WidgetCell cell={cell} timeRange={timeRange} source={source} />
: <RefreshingGraph : <RefreshingGraph
colors={colors} colors={colors}
preventLoad={cell.preventLoad} notInView={cell.notInView}
axes={axes} axes={axes}
type={type} type={type}
cellHeight={h} cellHeight={h}

View File

@ -13,7 +13,7 @@ const RefreshingGaugeChart = AutoRefresh(GaugeChart)
const RefreshingGraph = ({ const RefreshingGraph = ({
axes, axes,
preventLoad, notInView,
type, type,
colors, colors,
onZoom, onZoom,
@ -80,7 +80,7 @@ const RefreshingGraph = ({
colors={colors} colors={colors}
onZoom={onZoom} onZoom={onZoom}
queries={queries} queries={queries}
preventLoad={preventLoad} notInView={notInView}
key={manualRefresh} key={manualRefresh}
templates={templates} templates={templates}
timeRange={timeRange} timeRange={timeRange}
@ -124,12 +124,12 @@ RefreshingGraph.propTypes = {
value: string.isRequired, value: string.isRequired,
}).isRequired }).isRequired
), ),
preventLoad: bool, notInView: bool,
} }
RefreshingGraph.defaultProps = { RefreshingGraph.defaultProps = {
manualRefresh: 0, manualRefresh: 0,
preventLoad: false, notInView: false,
} }
export default RefreshingGraph export default RefreshingGraph