-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Numerous improvements to SQL Lab (#1088)
* Improving the Visualize flow * Fixed the timer * CTAS * Expiclit engine handling * make tab full height, stretch for longer content (#1081) * Better error handling for queries * Hooked and fixed CSV export * Linting * Tying in the dttm in the viz flow * Indicator showing when going offline * Addressing comments, fixing the build * Fixing unit tests
- Loading branch information
1 parent
c20ee0c
commit 1971bf6
Showing
19 changed files
with
298 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 71 additions & 30 deletions
101
caravel/assets/javascripts/SqlLab/components/SouthPane.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,85 @@ | ||
import { Alert, Tab, Tabs } from 'react-bootstrap'; | ||
import { Alert, Button, Tab, Tabs } from 'react-bootstrap'; | ||
import QueryHistory from './QueryHistory'; | ||
import ResultSet from './ResultSet'; | ||
import React from 'react'; | ||
|
||
const SouthPane = function (props) { | ||
let results = <div />; | ||
if (props.latestQuery) { | ||
if (props.latestQuery.state === 'running') { | ||
results = ( | ||
<img className="loading" alt="Loading.." src="/static/assets/images/loading.gif" /> | ||
); | ||
} else if (props.latestQuery.state === 'failed') { | ||
results = <Alert bsStyle="danger">{props.latestQuery.msg}</Alert>; | ||
} else if (props.latestQuery.state === 'success') { | ||
results = <ResultSet showControls query={props.latestQuery} />; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import * as Actions from '../actions'; | ||
import shortid from 'shortid'; | ||
|
||
class SouthPane extends React.Component { | ||
popSelectStar() { | ||
const qe = { | ||
id: shortid.generate(), | ||
title: this.props.latestQuery.tempTable, | ||
autorun: false, | ||
dbId: this.props.latestQuery.dbId, | ||
sql: `SELECT * FROM ${this.props.latestQuery.tempTable}`, | ||
}; | ||
this.props.actions.addQueryEditor(qe); | ||
} | ||
render() { | ||
let results = <div />; | ||
const latestQuery = this.props.latestQuery; | ||
if (latestQuery) { | ||
if (['running', 'pending'].includes(latestQuery.state)) { | ||
results = ( | ||
<img className="loading" alt="Loading.." src="/static/assets/images/loading.gif" /> | ||
); | ||
} else if (latestQuery.state === 'failed') { | ||
results = <Alert bsStyle="danger">{latestQuery.errorMessage}</Alert>; | ||
} else if (latestQuery.state === 'success' && latestQuery.ctas) { | ||
results = ( | ||
<div> | ||
<Alert bsStyle="info"> | ||
Table [<strong>{latestQuery.tempTable}</strong>] was created | ||
</Alert> | ||
<p> | ||
<Button | ||
bsSize="small" | ||
className="m-r-5" | ||
onClick={this.popSelectStar.bind(this)} | ||
> | ||
Query in a new tab | ||
</Button> | ||
<Button bsSize="small">Visualize</Button> | ||
</p> | ||
</div>); | ||
} else if (latestQuery.state === 'success') { | ||
results = <ResultSet showControls search query={latestQuery} />; | ||
} | ||
} else { | ||
results = <Alert bsStyle="info">Run a query to display results here</Alert>; | ||
} | ||
} else { | ||
results = <Alert bsStyle="info">Run a query to display results here</Alert>; | ||
return ( | ||
<div className="SouthPane"> | ||
<Tabs bsStyle="tabs"> | ||
<Tab title="Results" eventKey={1}> | ||
<div style={{ overflow: 'auto' }}> | ||
{results} | ||
</div> | ||
</Tab> | ||
<Tab title="Query History" eventKey={2}> | ||
<QueryHistory /> | ||
</Tab> | ||
</Tabs> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<div className="SouthPane"> | ||
<Tabs bsStyle="tabs"> | ||
<Tab title="Results" eventKey={1}> | ||
<div style={{ overflow: 'auto' }}> | ||
{results} | ||
</div> | ||
</Tab> | ||
<Tab title="Query History" eventKey={2}> | ||
<QueryHistory /> | ||
</Tab> | ||
</Tabs> | ||
</div> | ||
); | ||
}; | ||
} | ||
|
||
SouthPane.propTypes = { | ||
latestQuery: React.PropTypes.object, | ||
actions: React.PropTypes.object, | ||
}; | ||
|
||
SouthPane.defaultProps = { | ||
}; | ||
|
||
export default SouthPane; | ||
function mapDispatchToProps(dispatch) { | ||
return { | ||
actions: bindActionCreators(Actions, dispatch), | ||
}; | ||
} | ||
export default connect(null, mapDispatchToProps)(SouthPane); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.