Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Issue #24493; Resolved report selection menu in chart and dashboard page #25157

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
);
Expand Down Expand Up @@ -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(
Expand All @@ -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);
Expand Down Expand Up @@ -272,12 +264,7 @@ export const useExploreAdditionalActionsMenu = (

const menu = useMemo(
() => (
<Menu
onClick={handleMenuClick}
selectable={false}
openKeys={openSubmenus}
onOpenChange={setOpenSubmenus}
>
<Menu onClick={handleMenuClick} selectable={false} {...rest}>
<>
{slice && (
<Menu.Item key={MENU_KEYS.EDIT_PROPERTIES}>
Expand Down Expand Up @@ -423,7 +410,6 @@ export const useExploreAdditionalActionsMenu = (
handleMenuClick,
isDropdownVisible,
latestQueryFormData,
openSubmenus,
showReportSubMenu,
slice,
theme.gridUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default function HeaderReportDropDown({
setShowReportSubMenu,
setIsDropdownVisible,
isDropdownVisible,
...rest
}: HeaderReportProps) {
const dispatch = useDispatch();
const report = useSelector<any, AlertObject>(state => {
Expand Down Expand Up @@ -214,15 +215,17 @@ export default function HeaderReportDropDown({

const textMenu = () =>
isEmpty(report) ? (
<Menu selectable={false} css={onMenuHover}>
<Menu selectable={false} {...rest} css={onMenuHover}>
<Menu.Item onClick={handleShowMenu}>
{DropdownItemExtension ? (
<StyledDropdownItemWithIcon>
<div>{t('Set up an email report')}</div>
<DropdownItemExtension />
</StyledDropdownItemWithIcon>
) : (
t('Set up an email report')
<React.Fragment>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably don't need the React.Fragment here since there's a singular div as the child.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will remove that.

<div>{t('Set up an email report')}</div>
</React.Fragment>
)}
</Menu.Item>
<Menu.Divider />
Expand Down
Loading