Skip to content

Commit

Permalink
Fix no aggregations message appearing on unsupported charts.
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml committed Oct 19, 2022
1 parent bb43302 commit 85d080f
Showing 1 changed file with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,32 @@ const DrillDetailMenuItems = ({
return isEmpty(metrics);
}, [formData]);

const drillToDetailMenuItem = noAggregations ? (
<DisabledMenuItem {...props} key="drill-detail-no-aggregations">
{t('Drill to detail')}
<DisabledMenuItemTooltip
title={t(
'Drill to detail is disabled because this chart does not group data by dimension value.',
)}
/>
</DisabledMenuItem>
) : (
<Menu.Item
{...props}
key="drill-detail-no-filters"
onClick={openModal.bind(null, [])}
>
{t('Drill to detail')}
</Menu.Item>
);

let drillToDetailByMenuItem;
if (noAggregations) {
drillToDetailByMenuItem = (
<DisabledMenuItem {...props} key="drill-detail-by-no-aggregations">
{t('Drill to detail by')}
let drillToDetailMenuItem;
if (handlesDimensionContextMenu && noAggregations) {
drillToDetailMenuItem = (
<DisabledMenuItem {...props} key="drill-detail-no-aggregations">
{t('Drill to detail')}
<DisabledMenuItemTooltip
title={t(
'Drill to detail is disabled because this chart does not group data by dimension value.',
)}
/>
</DisabledMenuItem>
);
} else {
drillToDetailMenuItem = (
<Menu.Item
{...props}
key="drill-detail-no-filters"
onClick={openModal.bind(null, [])}
>
{t('Drill to detail')}
</Menu.Item>
);
}

if (!noAggregations && !handlesDimensionContextMenu) {
let drillToDetailByMenuItem;
if (!handlesDimensionContextMenu) {
drillToDetailByMenuItem = (
<DisabledMenuItem {...props} key="drill-detail-by-chart-not-supported">
{t('Drill to detail by')}
Expand All @@ -171,7 +168,15 @@ const DrillDetailMenuItems = ({
);
}

if (!noAggregations && handlesDimensionContextMenu && filters?.length) {
if (handlesDimensionContextMenu && noAggregations) {
drillToDetailByMenuItem = (
<DisabledMenuItem {...props} key="drill-detail-by-no-aggregations">
{t('Drill to detail by')}
</DisabledMenuItem>
);
}

if (handlesDimensionContextMenu && !noAggregations && filters?.length) {
drillToDetailByMenuItem = (
<Menu.SubMenu {...props} title={t('Drill to detail by')}>
<div data-test="drill-to-detail-by-submenu">
Expand Down Expand Up @@ -200,7 +205,7 @@ const DrillDetailMenuItems = ({
);
}

if (!noAggregations && handlesDimensionContextMenu && !filters?.length) {
if (handlesDimensionContextMenu && !noAggregations && !filters?.length) {
drillToDetailByMenuItem = (
<DisabledMenuItem {...props} key="drill-detail-by-select-aggregation">
{t('Drill to detail by')}
Expand Down

0 comments on commit 85d080f

Please sign in to comment.