[sql lab] specify schema name when generating vanila query (#1096)

* [sql lab] specify schema name when generating vanila query

* Fixing some react warnings
This commit is contained in:
Maxime Beauchemin 2016-09-12 23:09:18 -07:00 committed by GitHub
parent 1f761c61dd
commit df533d30fc
6 changed files with 18 additions and 11 deletions

View File

@ -46,8 +46,8 @@ class QueryAutoRefresh extends React.Component {
}
QueryAutoRefresh.propTypes = {
actions: React.PropTypes.object,
queriesLastUpdate: React.PropTypes.integer,
networkOn: React.PropTypes.boolean,
queriesLastUpdate: React.PropTypes.number,
networkOn: React.PropTypes.bool,
};
QueryAutoRefresh.defaultProps = {
// queries: null,

View File

@ -88,8 +88,8 @@ class ResultSet extends React.Component {
}
ResultSet.propTypes = {
query: React.PropTypes.object,
showControls: React.PropTypes.boolean,
search: React.PropTypes.boolean,
showControls: React.PropTypes.bool,
search: React.PropTypes.bool,
searchText: React.PropTypes.string,
};
ResultSet.defaultProps = {

View File

@ -179,7 +179,7 @@ SqlEditorTopToolbar.propTypes = {
queryEditor: React.PropTypes.object,
tables: React.PropTypes.array,
actions: React.PropTypes.object,
networkOn: React.PropTypes.boolean,
networkOn: React.PropTypes.bool,
};
SqlEditorTopToolbar.defaultProps = {

View File

@ -32,8 +32,8 @@ SqlShrink.defaultProps = {
SqlShrink.propTypes = {
sql: React.PropTypes.string,
maxWidth: React.PropTypes.integer,
maxLines: React.PropTypes.integer,
maxWidth: React.PropTypes.number,
maxLines: React.PropTypes.number,
};
export default SqlShrink;

View File

@ -19,7 +19,11 @@ class TableElement extends React.Component {
cols += ', ';
}
});
return `SELECT ${cols}\nFROM ${this.props.table.name}`;
let tableName = this.props.table.name;
if (this.props.table.schema) {
tableName = this.props.table.schema + '.' + tableName;
}
return `SELECT ${cols}\nFROM ${tableName}`;
}
popSelectStar() {

View File

@ -26,6 +26,8 @@ class VisualizeModal extends React.Component {
columns: {},
hints: [],
};
}
componentDidMount() {
this.validate();
}
validate() {
@ -135,8 +137,8 @@ class VisualizeModal extends React.Component {
/>
),
}));
const alerts = this.state.hints.map((hint) => (
<Alert bsStyle="warning">{hint}</Alert>
const alerts = this.state.hints.map((hint, i) => (
<Alert bsStyle="warning" key={i}>{hint}</Alert>
));
const modal = (
<div className="VisualizeModal">
@ -191,11 +193,12 @@ class VisualizeModal extends React.Component {
}
VisualizeModal.propTypes = {
query: React.PropTypes.object,
show: React.PropTypes.boolean,
show: React.PropTypes.bool,
onHide: React.PropTypes.function,
};
VisualizeModal.defaultProps = {
show: false,
onHide: () => {},
};
function mapStateToProps() {