Skip to content

Commit

Permalink
address pr comments and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
alanna scott committed Mar 27, 2017
1 parent 8f93d7f commit 677f03d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ class QueryAutoRefresh extends React.PureComponent {
shouldCheckForQueries() {
// if there are started or pending queries, this method should return true
const { queries } = this.props;
const queryKeys = Object.keys(queries);
const pendingOrStartedQueries = queryKeys.map((key) => {
const queryKeys = Object.keys(queries);
/* eslint consistent-return: 0 */
const pendingOrStartedQueries = queryKeys.forEach((key) => {
if (queries[key].state === 'running' || queries[key].state === 'started') {
return key;
return true;
}
});
return pendingOrStartedQueries.filter(q => q !== undefined).length > 0;
return pendingOrStartedQueries;
}
startTimer() {
if (!(this.timer)) {
Expand All @@ -35,9 +36,9 @@ class QueryAutoRefresh extends React.PureComponent {
this.timer = null;
}
stopwatch() {
const url = '/superset/queries/' + (this.props.queriesLastUpdate - QUERY_UPDATE_BUFFER_MS);
// only poll /superset/queries/ if there are started or running queries
if (this.shouldCheckForQueries()) {
const url = '/superset/queries/' + (this.props.queriesLastUpdate - QUERY_UPDATE_BUFFER_MS);
$.getJSON(url, (data) => {
if (Object.keys(data).length > 0) {
this.props.actions.refreshQueries(data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const $ = window.$ = require('jquery');
import React from 'react';
import { Label, Button } from 'react-bootstrap';
import { Button } from 'react-bootstrap';
import TableElement from './TableElement';
import AsyncSelect from '../../components/AsyncSelect';
import Select from 'react-virtualized-select';
Expand Down

0 comments on commit 677f03d

Please sign in to comment.