Implement stop query functionality. (#2387)

* Implement stop query functionality.

* Address comments
This commit is contained in:
Bogdan
2017-03-13 13:54:38 -07:00
committed by GitHub
parent 0779da6d24
commit 6160a3fdff
7 changed files with 78 additions and 3 deletions

View File

@@ -142,6 +142,24 @@ export function runQuery(query) {
};
}
export function postStopQuery(query) {
return function (dispatch) {
const stopQueryUrl = '/superset/stop_query/';
const stopQueryRequestData = { client_id: query.id };
$.ajax({
type: 'POST',
dataType: 'json',
url: stopQueryUrl,
data: stopQueryRequestData,
success() {
if (!query.runAsync) {
dispatch(stopQuery(query));
}
},
});
};
}
export function setDatabases(databases) {
return { type: SET_DATABASES, databases };
}

View File

@@ -83,7 +83,7 @@ class SqlEditor extends React.PureComponent {
this.props.actions.setActiveSouthPaneTab('Results');
}
stopQuery() {
this.props.actions.stopQuery(this.props.latestQuery);
this.props.actions.postStopQuery(this.props.latestQuery);
}
createTableAs() {
this.startQuery(true, true);