[sql-lab] performance updates - make ui more responsive (#2469)

* remove network status feature

* only fetch queries if there are started or running queries

* don't use local storage

* remove last network status from actions

* don't remove support for local storage

* address pr comments and linting

* use .some rather than .forEach
This commit is contained in:
Alanna Scott
2017-03-27 12:46:36 -07:00
committed by GitHub
parent 75e7f2d22c
commit 43dd948476
7 changed files with 21 additions and 45 deletions

View File

@@ -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';
@@ -10,12 +10,10 @@ const propTypes = {
queryEditor: React.PropTypes.object.isRequired,
tables: React.PropTypes.array,
actions: React.PropTypes.object,
networkOn: React.PropTypes.bool,
};
const defaultProps = {
tables: [],
networkOn: true,
actions: {},
};
@@ -27,7 +25,6 @@ class SqlEditorLeftBar extends React.PureComponent {
schemaOptions: [],
tableLoading: false,
tableOptions: [],
networkOn: true,
};
}
componentWillMount() {
@@ -125,17 +122,12 @@ class SqlEditorLeftBar extends React.PureComponent {
this.refs[ref].hide();
}
render() {
let networkAlert = null;
if (!this.props.networkOn) {
networkAlert = <p><Label bsStyle="danger">OFFLINE</Label></p>;
}
const shouldShowReset = window.location.search === '?reset=1';
const options = this.state.tableOptions;
const filterOptions = createFilterOptions({ options });
return (
<div className="scrollbar-container">
<div className="clearfix sql-toolbar scrollbar-content">
{networkAlert}
<div>
<AsyncSelect
dataEndpoint="/databaseasync/api/read?_flt_0_expose_in_sqllab=1"