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 dashboardCell = {
...cell,
preventLoad: !inView(cell),
notInView: !inView(cell),
}
dashboardCell.queries = dashboardCell.queries.map(q => ({
...q,

View File

@ -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,

View File

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

View File

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