From e77bc066bd1158113c4f1e72824f065ae8099929 Mon Sep 17 00:00:00 2001 From: Sandeep Patel <33354423+suicide11@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:40:42 +0530 Subject: [PATCH] fix: Issue #24493; Resolved report selection menu in chart and dashboard page (#25157) (cherry picked from commit d0305445b2782264834821c3f1276d74c1b5f99f) --- .../ReportModal/HeaderReportDropdown/index.tsx | 3 ++- .../useExploreAdditionalActionsMenu/index.jsx | 18 ++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx index b2e47cc53cb47..4f560a2294a4e 100644 --- a/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/components/ReportModal/HeaderReportDropdown/index.tsx @@ -114,6 +114,7 @@ export default function HeaderReportDropDown({ setShowReportSubMenu, setIsDropdownVisible, isDropdownVisible, + ...rest }: HeaderReportProps) { const dispatch = useDispatch(); const report = useSelector(state => { @@ -214,7 +215,7 @@ export default function HeaderReportDropDown({ const textMenu = () => isEmpty(report) ? ( - + {DropdownItemExtension ? ( diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx index 9dd0bc0ef0844..f153b5f3bd5f1 100644 --- a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx +++ b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx @@ -114,12 +114,12 @@ export const useExploreAdditionalActionsMenu = ( onOpenPropertiesModal, ownState, dashboards, + ...rest ) => { const theme = useTheme(); const { addDangerToast, addSuccessToast } = useToasts(); const [showReportSubMenu, setShowReportSubMenu] = useState(null); const [isDropdownVisible, setIsDropdownVisible] = useState(false); - const [openSubmenus, setOpenSubmenus] = useState([]); const chart = useSelector( state => state.charts?.[getChartKey(state.explore)], ); @@ -204,23 +204,19 @@ export const useExploreAdditionalActionsMenu = ( case MENU_KEYS.EXPORT_TO_CSV: exportCSV(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.EXPORT_TO_CSV_PIVOTED: exportCSVPivoted(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.EXPORT_TO_JSON: exportJson(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.EXPORT_TO_XLSX: exportExcel(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.DOWNLOAD_AS_IMAGE: downloadAsImage( @@ -230,21 +226,17 @@ export const useExploreAdditionalActionsMenu = ( true, )(domEvent); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.COPY_PERMALINK: copyLink(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.EMBED_CODE: setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.SHARE_BY_EMAIL: shareByEmail(); setIsDropdownVisible(false); - setOpenSubmenus([]); break; case MENU_KEYS.VIEW_QUERY: setIsDropdownVisible(false); @@ -272,12 +264,7 @@ export const useExploreAdditionalActionsMenu = ( const menu = useMemo( () => ( - + <> {slice && ( @@ -423,7 +410,6 @@ export const useExploreAdditionalActionsMenu = ( handleMenuClick, isDropdownVisible, latestQueryFormData, - openSubmenus, showReportSubMenu, slice, theme.gridUnit,