Adding indexes to table metadata (#1160)

This commit is contained in:
Maxime Beauchemin
2016-09-21 14:40:33 -07:00
committed by GitHub
parent 5a0e06e7a2
commit f1e80a8e1b
4 changed files with 34 additions and 0 deletions

View File

@@ -102,22 +102,27 @@ class SqlEditorTopToolbar extends React.Component {
const tableName = tableOpt.value;
const qe = this.props.queryEditor;
const url = `/caravel/table/${qe.dbId}/${tableName}/${qe.schema}/`;
this.setState({ tableLoading: true });
$.get(url, (data) => {
this.props.actions.addTable({
id: shortid.generate(),
dbId: this.props.queryEditor.dbId,
queryEditorId: this.props.queryEditor.id,
name: data.name,
indexes: data.indexes,
schema: qe.schema,
columns: data.columns,
expanded: true,
});
this.setState({ tableLoading: false });
})
.fail(() => {
this.props.actions.addAlert({
msg: 'Error occurred while fetching metadata',
bsStyle: 'danger',
});
this.setState({ tableLoading: false });
});
}
render() {