After saving slice fixing redirect (#3572)

This commit is contained in:
michellethomas 2017-10-02 18:19:52 -07:00 committed by Maxime Beauchemin
parent f8cc05b54e
commit 064363df78
2 changed files with 16 additions and 10 deletions

View File

@ -108,7 +108,11 @@ class SaveModal extends React.Component {
this.props.actions.saveSlice(saveUrl)
.then((data) => {
// Go to new slice url or dashboard url
window.location = data.slice.slice_url;
if (gotodash) {
window.location = data.dashboard;
} else {
window.location = data.slice.slice_url;
}
});
this.props.onHide();
}

View File

@ -1194,16 +1194,18 @@ class Superset(BaseSupersetView):
dash.slices.append(slc)
db.session.commit()
response = {
"can_add": slice_add_perm,
"can_download": slice_download_perm,
"can_overwrite": is_owner(slc, g.user),
'form_data': form_data,
'slice': slc.data,
}
if request.args.get('goto_dash') == 'true':
return dash.url
else:
return json_success(json.dumps({
"can_add": slice_add_perm,
"can_download": slice_download_perm,
"can_overwrite": is_owner(slc, g.user),
'form_data': form_data,
'slice': slc.data,
}))
response.update({'dashboard': dash.url})
return json_success(json.dumps(response))
def save_slice(self, slc):
session = db.session()