mirror of
https://github.com/apache/superset.git
synced 2026-05-11 19:05:24 +00:00
fix: permalink save/overwrites in explore (#25112)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
@@ -164,6 +164,17 @@ class SaveModal extends React.Component<SaveModalProps, SaveModalState> {
|
||||
this.props.dispatch(setSaveChartModalVisibility(false));
|
||||
}
|
||||
|
||||
handleRedirect = (windowLocationSearch: string, chart: any) => {
|
||||
const searchParams = new URLSearchParams(windowLocationSearch);
|
||||
searchParams.set('save_action', this.state.action);
|
||||
if (this.state.action !== 'overwrite') {
|
||||
searchParams.delete('form_data_key');
|
||||
}
|
||||
|
||||
searchParams.set('slice_id', chart.id.toString());
|
||||
return searchParams;
|
||||
};
|
||||
|
||||
async saveOrOverwrite(gotodash: boolean) {
|
||||
this.setState({ isLoading: true });
|
||||
|
||||
@@ -270,14 +281,7 @@ class SaveModal extends React.Component<SaveModalProps, SaveModalState> {
|
||||
return;
|
||||
}
|
||||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
searchParams.set('save_action', this.state.action);
|
||||
if (this.state.action !== 'overwrite') {
|
||||
searchParams.delete('form_data_key');
|
||||
}
|
||||
if (this.state.action === 'saveas') {
|
||||
searchParams.set('slice_id', value.id.toString());
|
||||
}
|
||||
const searchParams = this.handleRedirect(window.location.search, value);
|
||||
this.props.history.replace(`/explore/?${searchParams.toString()}`);
|
||||
|
||||
this.setState({ isLoading: false });
|
||||
@@ -527,3 +531,6 @@ function mapStateToProps({
|
||||
}
|
||||
|
||||
export default withRouter(connect(mapStateToProps)(SaveModal));
|
||||
|
||||
// User for testing purposes need to revisit once we convert this to functional component
|
||||
export { SaveModal as PureSaveModal };
|
||||
|
||||
Reference in New Issue
Block a user