You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/08/10 05:01:33 UTC
[superset] 23/25: feat: better errors for report in charts and
dashboard (#16131)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit f59fe808f892d43a16ac8922539242644a1a1519
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Mon Aug 9 16:32:52 2021 -0400
feat: better errors for report in charts and dashboard (#16131)
* added google alert
* better errors and report actions
(cherry picked from commit 5ce38839e77bc70c725d9207c61b98db309df355)
---
superset-frontend/src/components/ReportModal/index.tsx | 2 +-
superset-frontend/src/reports/actions/reports.js | 15 +++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/superset-frontend/src/components/ReportModal/index.tsx b/superset-frontend/src/components/ReportModal/index.tsx
index 148b033..ec2ee4a 100644
--- a/superset-frontend/src/components/ReportModal/index.tsx
+++ b/superset-frontend/src/components/ReportModal/index.tsx
@@ -225,7 +225,7 @@ const ReportModal: FunctionComponent<ReportProps> = ({
onClick={onSave}
disabled={!currentReport?.name}
>
- Add
+ {isEditMode ? t('Save') : t('Add')}
</StyledFooterButton>
</>
);
diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/reports/actions/reports.js
index 0407383..c7eb0c9 100644
--- a/superset-frontend/src/reports/actions/reports.js
+++ b/superset-frontend/src/reports/actions/reports.js
@@ -19,6 +19,7 @@
/* eslint camelcase: 0 */
import { t, SupersetClient } from '@superset-ui/core';
import rison from 'rison';
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import { addDangerToast, addSuccessToast } from '../../messageToasts/actions';
export const SET_REPORT = 'SET_REPORT';
@@ -106,11 +107,17 @@ export const addReport = report => dispatch => {
dispatch({ type: ADD_REPORT, json });
dispatch(addSuccessToast(t('The report has been created')));
})
- .catch(() =>
+ .catch(async e => {
+ const parsedError = await getClientErrorObject(e);
+ const errorMessage = parsedError.message;
+ const errorArr = Object.keys(errorMessage);
+ const error = errorMessage[errorArr[0]][0];
dispatch(
- addDangerToast(t('An error occurred while creating this report.')),
- ),
- );
+ addDangerToast(
+ t('An error occurred while editing this report: %s', error),
+ ),
+ );
+ });
};
export const EDIT_REPORT = 'EDIT_REPORT';