mirror of
https://github.com/apache/superset.git
synced 2024-09-20 04:29:47 -04:00
38b8db8051
* Carapal react mockup This is really just a mock up written in React to try different components. It could become scaffolding to build a prototype, or not. * Merging in Alanna's theme tweaks for SQL lab * Tweak the display of the alert message in navbar * Sketching the middleware refresh for Queries * Adjustments * Implement timer sync. * CTAS * Refactor the queries to be stored as a dict. (#994) * Download csv endpoint. (#992) * CSV download engdpoint. * Use lower case booleans. * Replcate loop with the object lookup by key. * First changes for the sync * Address comments * Fix query deletions. Update only the queries from the store. * Sync queries using tmp_id. * simplify * Fix the tests in the carapal. (#1023) * Sync queries using tmp_id. * Fix the unit tests * Bux fixes. Pass 2. * Tweakin' & linting * Adding alpha label to the SQL LAb navbar entry * Fixing the python unit tests
59 lines
1.3 KiB
JavaScript
59 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
import { bindActionCreators } from 'redux';
|
|
import * as Actions from '../actions';
|
|
|
|
import QueryTable from './QueryTable';
|
|
import { Alert } from 'react-bootstrap';
|
|
|
|
const QueryHistory = (props) => {
|
|
const activeQeId = props.tabHistory[props.tabHistory.length - 1];
|
|
const queriesArray = [];
|
|
for (const id in props.queries) {
|
|
if (props.queries[id].sqlEditorId === activeQeId) {
|
|
queriesArray.push(props.queries[id]);
|
|
}
|
|
}
|
|
if (queriesArray.length > 0) {
|
|
return (
|
|
<QueryTable
|
|
columns={[
|
|
'state', 'started', 'duration', 'progress',
|
|
'rows', 'sql', 'output', 'actions',
|
|
]}
|
|
queries={queriesArray}
|
|
/>
|
|
);
|
|
}
|
|
return (
|
|
<Alert bsStyle="info">
|
|
No query history yet...
|
|
</Alert>
|
|
);
|
|
};
|
|
|
|
QueryHistory.defaultProps = {
|
|
queries: {},
|
|
};
|
|
|
|
QueryHistory.propTypes = {
|
|
queries: React.PropTypes.object,
|
|
tabHistory: React.PropTypes.array,
|
|
actions: React.PropTypes.object,
|
|
};
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
queries: state.queries,
|
|
tabHistory: state.tabHistory,
|
|
};
|
|
}
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
actions: bindActionCreators(Actions, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(QueryHistory);
|