Skip to content

Commit

Permalink
[sql lab] specify schema name when generating vanila query (#1096)
Browse files Browse the repository at this point in the history
* [sql lab] specify schema name when generating vanila query

* Fixing some react warnings
  • Loading branch information
mistercrunch committed Sep 13, 2016
1 parent 1f761c6 commit df533d3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions caravel/assets/javascripts/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions caravel/assets/javascripts/SqlLab/components/SqlShrink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class VisualizeModal extends React.Component {
columns: {},
hints: [],
};
}
componentDidMount() {
this.validate();
}
validate() {
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit df533d3

Please sign in to comment.