betodealmeida commented on a change in pull request #18131:
URL: https://github.com/apache/superset/pull/18131#discussion_r791037936
##########
File path:
superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
##########
@@ -46,21 +47,17 @@ export default function HeaderReportActionsDropDown({
chart?: ChartState;
}) {
const dispatch = useDispatch();
- const report: AlertObject = useSelector<any, AlertObject>(state => {
+
+ const findReport = useSelector<any, AlertObject>(state => {
if (dashboardId) {
return state.reports.dashboards?.[dashboardId];
}
if (chart?.id) {
- return state.reports.charts?.[chart.id];
+ return state.reports.charts?.[chart?.id];
}
return {};
});
- // const report: ReportObject = Object.values(reports).filter(report => {
- // if (dashboardId) {
- // return report.dashboards?.[dashboardId];
- // }
- // // return report.charts?.[chart?.id]
- // })[0];
+ const report = findReport;
Review comment:
If `report = findReport` just use `findReport` wherever you'd use
`report`.
##########
File path: superset-frontend/src/views/CRUD/alert/types.ts
##########
@@ -81,14 +82,15 @@ export type AlertObject = {
sql?: string;
timezone?: string;
recipients?: Array<Recipient>;
- report_format?: 'PNG' | 'CSV' | 'TEXT';
+ report_format?: 'PNG' | 'CSV' | 'TEXT' | string;
Review comment:
Why are you adding `string` here? Are there other values other than
PNG/CSV/TEXT that are valid here? If you add `string` it means that
`report_format` can have any value.
+1 on using an enum like @hughhhh said.
--
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]