Skip to content

Commit

Permalink
After saving slice fixing redirect (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
michellethomas authored and mistercrunch committed Oct 3, 2017
1 parent f8cc05b commit 064363d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
6 changes: 5 additions & 1 deletion superset/assets/javascripts/explore/components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
20 changes: 11 additions & 9 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,16 +1194,18 @@ def save_or_overwrite_slice(
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()
Expand Down

0 comments on commit 064363d

Please sign in to comment.