feat(dashboard): enable cmd+click for dashboard name in list (#3947)

This commit is contained in:
Joe Milton 2023-11-16 13:12:43 +05:30 committed by GitHub
parent dc7a55e871
commit d8a8430a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
import { LockFilled } from '@ant-design/icons'; import { LockFilled } from '@ant-design/icons';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import history from 'lib/history'; import history from 'lib/history';
import { generatePath } from 'react-router-dom';
import { Data } from '..'; import { Data } from '..';
import { TableLinkText } from './styles'; import { TableLinkText } from './styles';
@ -9,12 +8,14 @@ import { TableLinkText } from './styles';
function Name(name: Data['name'], data: Data): JSX.Element { function Name(name: Data['name'], data: Data): JSX.Element {
const { id: DashboardId, isLocked } = data; const { id: DashboardId, isLocked } = data;
const onClickHandler = (): void => { const getLink = (): string => `${ROUTES.ALL_DASHBOARD}/${DashboardId}`;
history.push(
generatePath(ROUTES.DASHBOARD, { const onClickHandler = (event: React.MouseEvent<HTMLElement>): void => {
dashboardId: DashboardId, if (event.metaKey || event.ctrlKey) {
}), window.open(getLink(), '_blank');
); } else {
history.push(getLink());
}
}; };
return ( return (