[sqllab] some frontend tests (#1400)

* [sqllab] some frontend tests

* linting

* Addressing comments

* Addressing unaddressed comments

* Touchups
This commit is contained in:
Maxime Beauchemin
2016-10-25 16:44:32 -07:00
committed by GitHub
parent 7c5933732b
commit 940659bc14
44 changed files with 875 additions and 558 deletions

View File

@@ -1,9 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as Actions from '../actions';
import moment from 'moment';
import { Table } from 'reactable';
import { Label, ProgressBar } from 'react-bootstrap';
@@ -67,6 +63,9 @@ class QueryTable extends React.Component {
clearQueryResults(query) {
this.props.actions.clearQueryResults(query);
}
removeQuery(query) {
this.props.actions.removeQuery(query);
}
render() {
const data = this.props.queries.map((query) => {
@@ -111,7 +110,7 @@ class QueryTable extends React.Component {
modalTitle={'Data preview'}
beforeOpen={this.openAsyncResults.bind(this, query)}
onExit={this.clearQueryResults.bind(this, query)}
modalBody={<ResultSet showSql query={query} />}
modalBody={<ResultSet showSql query={query} actions={this.props.actions} />}
/>
);
} else {
@@ -163,7 +162,7 @@ class QueryTable extends React.Component {
<Link
className="fa fa-trash m-r-3"
tooltip="Remove query from log"
onClick={this.props.actions.removeQuery.bind(this, query)}
onClick={this.removeQuery.bind(this, query)}
/>
</div>
);
@@ -198,13 +197,4 @@ class QueryTable extends React.Component {
QueryTable.propTypes = propTypes;
QueryTable.defaultProps = defaultProps;
function mapStateToProps() {
return {};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(Actions, dispatch),
};
}
export { QueryTable };
export default connect(mapStateToProps, mapDispatchToProps)(QueryTable);
export default QueryTable;