mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
parent
7c95595b77
commit
4359650b7d
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
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 Icons from 'src/components/Icons';
|
||||||
import { Switch } from 'src/components/Switch';
|
import { Switch } from 'src/components/Switch';
|
||||||
import { AlertObject } from 'src/views/CRUD/alert/types';
|
import { AlertObject } from 'src/views/CRUD/alert/types';
|
||||||
@ -47,6 +47,7 @@ export default function HeaderReportActionsDropDown({
|
|||||||
currentReportDeleting,
|
currentReportDeleting,
|
||||||
setCurrentReportDeleting,
|
setCurrentReportDeleting,
|
||||||
] = useState<AlertObject | null>(null);
|
] = useState<AlertObject | null>(null);
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const toggleActiveKey = async (data: AlertObject, checked: boolean) => {
|
const toggleActiveKey = async (data: AlertObject, checked: boolean) => {
|
||||||
if (data?.id) {
|
if (data?.id) {
|
||||||
@ -60,7 +61,7 @@ export default function HeaderReportActionsDropDown({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const menu = () => (
|
const menu = () => (
|
||||||
<Menu selectable={false}>
|
<Menu selectable={false} css={{ width: '200px' }}>
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
{t('Email reports active')}
|
{t('Email reports active')}
|
||||||
<Switch
|
<Switch
|
||||||
@ -68,6 +69,7 @@ export default function HeaderReportActionsDropDown({
|
|||||||
checked={report?.active}
|
checked={report?.active}
|
||||||
onClick={(checked: boolean) => toggleActiveKey(report, checked)}
|
onClick={(checked: boolean) => toggleActiveKey(report, checked)}
|
||||||
size="small"
|
size="small"
|
||||||
|
css={{ marginLeft: theme.gridUnit * 2 }}
|
||||||
/>
|
/>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item onClick={showReportModal}>{t('Edit email report')}</Menu.Item>
|
<Menu.Item onClick={showReportModal}>{t('Edit email report')}</Menu.Item>
|
||||||
|
@ -102,8 +102,8 @@ export const addReport = report => dispatch => {
|
|||||||
endpoint: `/api/v1/report/`,
|
endpoint: `/api/v1/report/`,
|
||||||
jsonPayload: report,
|
jsonPayload: report,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(({ json }) => {
|
||||||
dispatch({ type: ADD_REPORT, report });
|
dispatch({ type: ADD_REPORT, json });
|
||||||
dispatch(addSuccessToast(t('The report has been created')));
|
dispatch(addSuccessToast(t('The report has been created')));
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user