From c7815332809ff1454050924a37d966047dfc4600 Mon Sep 17 00:00:00 2001 From: suicide11 Date: Fri, 1 Sep 2023 15:08:58 +0530 Subject: [PATCH 1/4] Resolved report selection menu in chart and dashboard page --- .../useExploreAdditionalActionsMenu/index.jsx | 14 ++------------ .../ReportModal/HeaderReportDropdown/index.tsx | 12 ++++++++---- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx index 45d8d3efabb41..e1ca6ab8fd97d 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); @@ -275,8 +267,7 @@ export const useExploreAdditionalActionsMenu = ( <> {slice && ( @@ -423,7 +414,6 @@ export const useExploreAdditionalActionsMenu = ( handleMenuClick, isDropdownVisible, latestQueryFormData, - openSubmenus, showReportSubMenu, slice, theme.gridUnit, diff --git a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index cd428b0abb9ab..ef2b106e71c7f 100644 --- a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/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,15 +215,18 @@ export default function HeaderReportDropDown({ const textMenu = () => isEmpty(report) ? ( - - + + {DropdownItemExtension ? ( -
{t('Set up an email report')}
+
{t('Set up an email report')}
) : ( - t('Set up an email report') + +
{t('Set up an email report')}
+
+ )}
From 177d2777176363c41a3e3fb3ce5fd4aab6e2b858 Mon Sep 17 00:00:00 2001 From: suicide11 Date: Fri, 1 Sep 2023 22:45:16 +0530 Subject: [PATCH 2/4] fixed linting issues --- .../components/useExploreAdditionalActionsMenu/index.jsx | 6 +----- .../reports/ReportModal/HeaderReportDropdown/index.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx index e1ca6ab8fd97d..2ccbbeb25e5f3 100644 --- a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx +++ b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx @@ -264,11 +264,7 @@ export const useExploreAdditionalActionsMenu = ( const menu = useMemo( () => ( - + <> {slice && ( diff --git a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index ef2b106e71c7f..dc77e05d12806 100644 --- a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx @@ -215,18 +215,17 @@ export default function HeaderReportDropDown({ const textMenu = () => isEmpty(report) ? ( - - + + {DropdownItemExtension ? ( -
{t('Set up an email report')}
+
{t('Set up an email report')}
) : ( -
{t('Set up an email report')}
+
{t('Set up an email report')}
- )}
From c23bf17416f6868d8d01b4392494b5abdae434c9 Mon Sep 17 00:00:00 2001 From: suicide11 Date: Sat, 2 Sep 2023 01:59:50 +0530 Subject: [PATCH 3/4] added menu hover styling --- .../features/reports/ReportModal/HeaderReportDropdown/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index dc77e05d12806..f80e9a1183abd 100644 --- a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx @@ -215,7 +215,7 @@ export default function HeaderReportDropDown({ const textMenu = () => isEmpty(report) ? ( - + {DropdownItemExtension ? ( From 3118b943072dfbf15a9cef9b02199aa872d6ece4 Mon Sep 17 00:00:00 2001 From: suicide11 Date: Sun, 3 Sep 2023 00:31:56 +0530 Subject: [PATCH 4/4] removed react fragment --- .../reports/ReportModal/HeaderReportDropdown/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index f80e9a1183abd..b38d44a710b78 100644 --- a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx @@ -223,9 +223,7 @@ export default function HeaderReportDropDown({ ) : ( - -
{t('Set up an email report')}
-
+ t('Set up an email report') )}