mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: save tabs when saving the query bug (#12607)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
@@ -139,44 +139,10 @@ export function queryValidationFailed(query, message, error) {
|
||||
return { type: QUERY_VALIDATION_FAILED, query, message, error };
|
||||
}
|
||||
|
||||
export function saveQuery(query) {
|
||||
return dispatch =>
|
||||
SupersetClient.post({
|
||||
endpoint: '/savedqueryviewapi/api/create',
|
||||
postPayload: convertQueryToServer(query),
|
||||
stringify: false,
|
||||
})
|
||||
.then(result => {
|
||||
dispatch({
|
||||
type: QUERY_EDITOR_SAVED,
|
||||
query,
|
||||
result: convertQueryToClient(result.json.item),
|
||||
});
|
||||
dispatch(addSuccessToast(t('Your query was saved')));
|
||||
})
|
||||
.catch(() =>
|
||||
dispatch(addDangerToast(t('Your query could not be saved'))),
|
||||
);
|
||||
}
|
||||
|
||||
export function updateQueryEditor(alterations) {
|
||||
return { type: UPDATE_QUERY_EDITOR, alterations };
|
||||
}
|
||||
|
||||
export function updateSavedQuery(query) {
|
||||
return dispatch =>
|
||||
SupersetClient.put({
|
||||
endpoint: `/savedqueryviewapi/api/update/${query.remoteId}`,
|
||||
postPayload: convertQueryToServer(query),
|
||||
stringify: false,
|
||||
})
|
||||
.then(() => dispatch(addSuccessToast(t('Your query was updated'))))
|
||||
.catch(() =>
|
||||
dispatch(addDangerToast(t('Your query could not be updated'))),
|
||||
)
|
||||
.then(() => dispatch(updateQueryEditor(query)));
|
||||
}
|
||||
|
||||
export function scheduleQuery(query) {
|
||||
return dispatch =>
|
||||
SupersetClient.post({
|
||||
@@ -847,6 +813,44 @@ export function queryEditorSetTitle(queryEditor, title) {
|
||||
};
|
||||
}
|
||||
|
||||
export function saveQuery(query) {
|
||||
return dispatch =>
|
||||
SupersetClient.post({
|
||||
endpoint: '/savedqueryviewapi/api/create',
|
||||
postPayload: convertQueryToServer(query),
|
||||
stringify: false,
|
||||
})
|
||||
.then(result => {
|
||||
dispatch({
|
||||
type: QUERY_EDITOR_SAVED,
|
||||
query,
|
||||
result: convertQueryToClient(result.json.item),
|
||||
});
|
||||
dispatch(addSuccessToast(t('Your query was saved')));
|
||||
dispatch(queryEditorSetTitle(query, query.title));
|
||||
})
|
||||
.catch(() =>
|
||||
dispatch(addDangerToast(t('Your query could not be saved'))),
|
||||
);
|
||||
}
|
||||
|
||||
export function updateSavedQuery(query) {
|
||||
return dispatch =>
|
||||
SupersetClient.put({
|
||||
endpoint: `/savedqueryviewapi/api/update/${query.remoteId}`,
|
||||
postPayload: convertQueryToServer(query),
|
||||
stringify: false,
|
||||
})
|
||||
.then(() => {
|
||||
dispatch(addSuccessToast(t('Your query was updated')));
|
||||
dispatch(queryEditorSetTitle(query, query.title));
|
||||
})
|
||||
.catch(() =>
|
||||
dispatch(addDangerToast(t('Your query could not be updated'))),
|
||||
)
|
||||
.then(() => dispatch(updateQueryEditor(query)));
|
||||
}
|
||||
|
||||
export function queryEditorSetSql(queryEditor, sql) {
|
||||
return function (dispatch) {
|
||||
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
|
||||
|
||||
Reference in New Issue
Block a user