fastforward to apache/master

This commit is contained in:
Hugh Miles
2018-01-24 17:05:57 -08:00
parent 36956a5d24
commit 63cbcb80c3
26 changed files with 278 additions and 85 deletions

View File

@@ -22,7 +22,7 @@ class QueryAutoRefresh extends React.PureComponent {
const queryKeys = Object.keys(queries);
const queriesAsArray = queryKeys.map(key => queries[key]);
return queriesAsArray.some(q =>
['running', 'started', 'pending', 'fetching'].indexOf(q.state) >= 0);
['running', 'started', 'pending', 'fetching'].indexOf(q.state) >= 0).length;
}
startTimer() {
if (!(this.timer)) {

View File

@@ -144,7 +144,8 @@ export default class ResultSet extends React.PureComponent {
}
render() {
const query = this.props.query;
const height = this.props.search ? this.props.height - SEARCH_HEIGHT : this.props.height;
const height = Math.max(0,
(this.props.search ? this.props.height - SEARCH_HEIGHT : this.props.height));
let sql;
if (this.props.showSql) {

View File

@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import throttle from 'lodash.throttle';
import {
Col,
FormGroup,
@@ -52,6 +53,9 @@ class SqlEditor extends React.PureComponent {
autorun: props.queryEditor.autorun,
ctas: '',
};
this.onResize = this.onResize.bind(this);
this.throttledResize = throttle(this.onResize, 250);
}
componentWillMount() {
if (this.state.autorun) {
@@ -62,12 +66,16 @@ class SqlEditor extends React.PureComponent {
}
componentDidMount() {
this.onResize();
window.addEventListener('resize', this.throttledResize);
}
componentWillUnmount() {
window.removeEventListener('resize', this.throttledResize);
}
onResize() {
const height = this.sqlEditorHeight();
this.setState({
editorPaneHeight: this.refs.ace.clientHeight,
southPaneHeight: height - this.refs.ace.clientHeight,
editorPaneHeight: this.props.queryEditor.height,
southPaneHeight: height - this.props.queryEditor.height,
height,
});
@@ -252,7 +260,7 @@ class SqlEditor extends React.PureComponent {
split="horizontal"
defaultSize={defaultNorthHeight}
minSize={100}
onChange={this.onResize.bind(this)}
onChange={this.onResize}
>
<div ref="ace" style={{ width: '100%' }}>
<div>
@@ -273,7 +281,7 @@ class SqlEditor extends React.PureComponent {
editorQueries={this.props.editorQueries}
dataPreviewQueries={this.props.dataPreviewQueries}
actions={this.props.actions}
height={this.state.southPaneHeight}
height={this.state.southPaneHeight || 0}
/>
</div>
</SplitPane>

View File

@@ -294,7 +294,7 @@ function mapStateToProps(state) {
return {
datasource: state.datasource,
errorMessage: state.errorMessage,
timeout: state.common ? state.common.SUPERSET_WEBSERVER_TIMEOUT : null,
timeout: state.common ? state.common.conf.SUPERSET_WEBSERVER_TIMEOUT : null,
};
}