mirror of https://github.com/apache/superset.git
[dashboard][bugfix][save as] re-direct to copied dashboard upon saveas (#6189)
* [dashboard][bugfix][save as] re-direct to copied dashboard upon saveas * [dashboard][save modal] safer destructuring * [dashboard][save as] simplify Promise resolution * [dashboard] simply fetch slices error
This commit is contained in:
parent
ef8429cbf5
commit
e7e8e9d00d
|
@ -132,16 +132,14 @@ export function saveDashboardRequest(data, id, saveType) {
|
|||
SupersetClient.post({
|
||||
endpoint: `/superset/${path}/${id}/`,
|
||||
postPayload: { data },
|
||||
parseMethod: null,
|
||||
})
|
||||
.then(response =>
|
||||
Promise.all([
|
||||
Promise.resolve(response),
|
||||
dispatch(saveDashboardRequestSuccess()),
|
||||
dispatch(
|
||||
addSuccessToast(t('This dashboard was saved successfully.')),
|
||||
),
|
||||
]),
|
||||
]).then(() => Promise.resolve(response)),
|
||||
)
|
||||
.catch(response =>
|
||||
getClientErrorObject(response).then(({ error }) =>
|
||||
|
|
|
@ -3,7 +3,10 @@ import { SupersetClient } from '@superset-ui/core';
|
|||
|
||||
import { addDangerToast } from '../../messageToasts/actions';
|
||||
import { t } from '../../locales';
|
||||
import { getDatasourceParameter } from '../../modules/utils';
|
||||
import {
|
||||
getDatasourceParameter,
|
||||
getClientErrorObject,
|
||||
} from '../../modules/utils';
|
||||
|
||||
export const SET_ALL_SLICES = 'SET_ALL_SLICES';
|
||||
export function setAllSlices(slices) {
|
||||
|
@ -64,22 +67,19 @@ export function fetchAllSlices(userId) {
|
|||
|
||||
return dispatch(setAllSlices(slices));
|
||||
})
|
||||
.catch(error =>
|
||||
Promise.all([
|
||||
.catch(errorResponse =>
|
||||
getClientErrorObject(errorResponse).then(({ error }) => {
|
||||
dispatch(
|
||||
fetchAllSlicesFailed(
|
||||
error.error ||
|
||||
error.statusText ||
|
||||
t('Could not fetch all saved charts'),
|
||||
error || t('Could not fetch all saved charts'),
|
||||
),
|
||||
),
|
||||
);
|
||||
dispatch(
|
||||
addDangerToast(
|
||||
t('Sorry there was an error fetching saved charts: ') +
|
||||
error.error || error.statusText,
|
||||
t('Sorry there was an error fetching saved charts: ') + error,
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class SaveModal extends React.PureComponent {
|
|||
t('You must pick a name for the new dashboard'),
|
||||
);
|
||||
} else {
|
||||
this.onSave(data, dashboardId, saveType).then(([resp]) => {
|
||||
this.onSave(data, dashboardId, saveType).then(resp => {
|
||||
if (
|
||||
saveType === SAVE_TYPE_NEWDASHBOARD &&
|
||||
resp &&
|
||||
|
|
Loading…
Reference in New Issue