This is an automated email from the ASF dual-hosted git repository.
ccwilliams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new e7e8e9d [dashboard][bugfix][save as] re-direct to copied dashboard
upon saveas (#6189)
e7e8e9d is described below
commit e7e8e9d00d926384e289a489847ae441aeef079e
Author: Chris Williams <[email protected]>
AuthorDate: Thu Oct 25 11:44:05 2018 -0700
[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
---
.../assets/src/dashboard/actions/dashboardState.js | 4 +---
.../assets/src/dashboard/actions/sliceEntities.js | 22 +++++++++++-----------
.../assets/src/dashboard/components/SaveModal.jsx | 2 +-
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/superset/assets/src/dashboard/actions/dashboardState.js
b/superset/assets/src/dashboard/actions/dashboardState.js
index 883a508..2ff139f 100644
--- a/superset/assets/src/dashboard/actions/dashboardState.js
+++ b/superset/assets/src/dashboard/actions/dashboardState.js
@@ -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 }) =>
diff --git a/superset/assets/src/dashboard/actions/sliceEntities.js
b/superset/assets/src/dashboard/actions/sliceEntities.js
index 33e3507..31a03db 100644
--- a/superset/assets/src/dashboard/actions/sliceEntities.js
+++ b/superset/assets/src/dashboard/actions/sliceEntities.js
@@ -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,
),
- ),
- ]),
+ );
+ }),
);
}
diff --git a/superset/assets/src/dashboard/components/SaveModal.jsx
b/superset/assets/src/dashboard/components/SaveModal.jsx
index 13863a2..2e3d949 100644
--- a/superset/assets/src/dashboard/components/SaveModal.jsx
+++ b/superset/assets/src/dashboard/components/SaveModal.jsx
@@ -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 &&