eschutho commented on a change in pull request #15856:
URL: https://github.com/apache/superset/pull/15856#discussion_r676938681
##########
File path: superset-frontend/src/components/ReportModal/index.tsx
##########
@@ -143,6 +126,51 @@ const ReportModal: FunctionComponent<ReportProps> = ({
setCurrentReport({ type, payload } as ReportActionType);
}, []);
const [error, setError] = useState<CronError>();
+ const [hasConnectedReport, setHasConnectedReport] = useState<boolean>(false);
+ const [isLoading, setLoading] = useState<boolean>(false);
+
+ // Report fetch logic
+ // Below is not needed, data will be passed in
+ const { createResource } = useSingleViewResource<ReportObject>(
+ 'report',
+ t('report'),
+ addDangerToast,
+ );
+
+ const onSave = async () => {
+ // Create new Report
+ const newReport: ReportObject = {
+ active: true,
+ crontab: currentReport?.crontab || '0 12 * * 1',
+ dashboard: props.props.dashboardId,
+ description: currentReport?.description || '',
+ log_retention: 90,
+ name: currentReport?.name || 'Weekly Report',
+ owners: [props.props.userId],
+ recipients: [
+ {
+ recipient_config_json: { target: props.props.userEmail },
+ type: 'Email',
+ },
+ ],
+ report_format: 'PNG',
+ type: 'Report',
+ validator_config_json: {},
+ validator_type: 'operator',
+ working_timeout: 3600,
+ creation_method: 'dashboards',
+ };
+
+ setLoading(true);
+ const currentReportID = await createResource(newReport as ReportObject);
Review comment:
instead of returning the id here, let it fall into state..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]