mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
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.
This commit is contained in:
51
caravel/assets/javascripts/SqlLab/components/QueryLog.jsx
Normal file
51
caravel/assets/javascripts/SqlLab/components/QueryLog.jsx
Normal file
@@ -0,0 +1,51 @@
|
||||
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';
|
||||
|
||||
class QueryLog extends React.Component {
|
||||
render() {
|
||||
const activeQeId = this.props.tabHistory[this.props.tabHistory.length - 1];
|
||||
const queries = this.props.queries.filter((q) => (q.sqlEditorId === activeQeId));
|
||||
if (queries.length > 0) {
|
||||
return (
|
||||
<QueryTable
|
||||
columns={['state', 'started', 'duration', 'rows', 'sql', 'actions']}
|
||||
queries={queries}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Alert bsStyle="info">
|
||||
No query history yet...
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
}
|
||||
QueryLog.defaultProps = {
|
||||
queries: [],
|
||||
};
|
||||
|
||||
QueryLog.propTypes = {
|
||||
queries: React.PropTypes.array,
|
||||
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)(QueryLog);
|
||||
@@ -1396,6 +1396,7 @@ class Caravel(BaseCaravelView):
|
||||
sql = request.form.get('sql')
|
||||
database_id = request.form.get('database_id')
|
||||
schema = request.form.get('schema')
|
||||
mydb = session.query(models.Database).filter_by(id=database_id).first()
|
||||
|
||||
if not (self.can_access(
|
||||
'all_datasource_access', 'all_datasource_access') or
|
||||
|
||||
Reference in New Issue
Block a user