From a691d3ba64eb4da03f64a7ade368a8af1280eb91 Mon Sep 17 00:00:00 2001 From: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Date: Wed, 4 Aug 2021 14:37:46 -0400 Subject: [PATCH] fix: Adding report bug (#16065) * report add fix * added theme --- .../ReportModal/HeaderReportActionsDropdown/index.tsx | 6 ++++-- superset-frontend/src/reports/actions/reports.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx index df0253c854ec..2ffc6f28600e 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx @@ -18,7 +18,7 @@ */ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; -import { t, SupersetTheme, css } from '@superset-ui/core'; +import { t, SupersetTheme, css, useTheme } from '@superset-ui/core'; import Icons from 'src/components/Icons'; import { Switch } from 'src/components/Switch'; import { AlertObject } from 'src/views/CRUD/alert/types'; @@ -47,6 +47,7 @@ export default function HeaderReportActionsDropDown({ currentReportDeleting, setCurrentReportDeleting, ] = useState(null); + const theme = useTheme(); const toggleActiveKey = async (data: AlertObject, checked: boolean) => { if (data?.id) { @@ -60,7 +61,7 @@ export default function HeaderReportActionsDropDown({ }; const menu = () => ( - + {t('Email reports active')} toggleActiveKey(report, checked)} size="small" + css={{ marginLeft: theme.gridUnit * 2 }} /> {t('Edit email report')} diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/reports/actions/reports.js index 546fe960c664..04073837aad5 100644 --- a/superset-frontend/src/reports/actions/reports.js +++ b/superset-frontend/src/reports/actions/reports.js @@ -102,8 +102,8 @@ export const addReport = report => dispatch => { endpoint: `/api/v1/report/`, jsonPayload: report, }) - .then(() => { - dispatch({ type: ADD_REPORT, report }); + .then(({ json }) => { + dispatch({ type: ADD_REPORT, json }); dispatch(addSuccessToast(t('The report has been created'))); }) .catch(() =>