alexandrusoare commented on code in PR #37109:
URL: https://github.com/apache/superset/pull/37109#discussion_r2731130969
##########
superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx:
##########
@@ -23,28 +23,40 @@ import { t } from '@apache-superset/core';
import {
BinaryQueryObjectFilterClause,
QueryFormData,
+ SupersetClient,
} from '@superset-ui/core';
import { css, useTheme } from '@apache-superset/core/ui';
-import { Button, Modal } from '@superset-ui/core/components';
-import { useSelector } from 'react-redux';
+import { Button, Modal, Dropdown } from '@superset-ui/core/components';
+import { useSelector, useDispatch } from 'react-redux';
+import { Icons } from '@superset-ui/core/components/Icons';
import { DashboardPageIdContext } from
'src/dashboard/containers/DashboardPage';
import { isEmbedded } from 'src/dashboard/util/isEmbedded';
import { Slice } from 'src/types/Chart';
import { RootState } from 'src/dashboard/types';
import { findPermission } from 'src/utils/findPermission';
+import { ensureAppRoot } from 'src/utils/pathUtils';
+import { safeStringify } from 'src/utils/safeStringify';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
import { Dataset } from '../types';
import DrillDetailPane from './DrillDetailPane';
+import { getDrillPayload } from './utils';
interface ModalFooterProps {
canExplore: boolean;
+ canDownload: boolean;
closeModal?: () => void;
exploreChart: () => void;
+ onDownloadCSV: () => void;
+ onDownloadXLSX: () => void;
}
const ModalFooter = ({
canExplore,
+ canDownload,
closeModal,
exploreChart,
+ onDownloadCSV,
+ onDownloadXLSX,
}: ModalFooterProps) => {
Review Comment:
I see that we have added this props to `ModalFooter`, shouldn't these
funtions be passed as props in the component that uses ModalFooter? I see only
one file modified
##########
superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx:
##########
@@ -117,6 +174,73 @@ export default function DrillDetailModal({
history.push(exploreUrl);
}, [exploreUrl, history]);
+ const handleDownload = useCallback(
+ (exportType: 'csv' | 'xlsx') => {
+ const drillPayload = getDrillPayload(formData, initialFilters);
+
+ if (!drillPayload) {
+ dispatch(addDangerToast(t('Unable to generate download payload')));
Review Comment:
Why do we need to dispatch here the toasts, can t we use them directly?
--
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]