Skip to content

Commit

Permalink
fix(Dashboard): Support "Edit chart" click on a new window (#28054)
Browse files Browse the repository at this point in the history
(cherry picked from commit 89da4f8)
  • Loading branch information
geido authored and sadpandajoe committed Apr 16, 2024
1 parent fc8fa90 commit 560abfd
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
const [openScopingModal, scopingModal] = useCrossFiltersScopingModal(
props.slice.slice_id,
);
const history = useHistory();

const queryMenuRef: RefObject<any> = useRef(null);
const menuRef: RefObject<any> = useRef(null);
Expand Down Expand Up @@ -590,7 +591,12 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
case MenuKeys.ExploreChart:
// eslint-disable-next-line no-unused-expressions
props.logExploreChart?.(props.slice.slice_id);
window.open(props.exploreUrl);
if (domEvent.metaKey || domEvent.ctrlKey) {
domEvent.preventDefault();
window.open(props.exploreUrl, '_blank');
} else {
history.push(props.exploreUrl);
}
break;
case MenuKeys.ExportCsv:
// eslint-disable-next-line no-unused-expressions
Expand Down Expand Up @@ -907,16 +913,6 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
placement="bottomRight"
visible={dropdownIsOpen}
onVisibleChange={status => toggleDropdown({ close: !status })}
onBlur={e => {
// close unless the dropdown menu is clicked
const relatedTarget = e.relatedTarget as HTMLElement;
if (
dropdownIsOpen &&
menuRef?.current?.props.id !== relatedTarget?.id
) {
toggleDropdown({ close: true });
}
}}
onKeyDown={e =>
handleDropdownNavigation(
e,
Expand Down

0 comments on commit 560abfd

Please sign in to comment.