fix(Dashboard): Support "Edit chart" click on a new window (#28054)
This commit is contained in:
parent
5a9ddbba2e
commit
89da4f82d3
|
|
@ -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);
|
||||
|
|
@ -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
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue