From d8a8430a5be0c0b562bd4f996fb5987ac0a341f7 Mon Sep 17 00:00:00 2001 From: Joe Milton <64725924+joemiltonm@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:12:43 +0530 Subject: [PATCH] feat(dashboard): enable cmd+click for dashboard name in list (#3947) --- .../ListOfDashboard/TableComponents/Name.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/container/ListOfDashboard/TableComponents/Name.tsx b/frontend/src/container/ListOfDashboard/TableComponents/Name.tsx index 6a85e7e136..a3f3427b6c 100644 --- a/frontend/src/container/ListOfDashboard/TableComponents/Name.tsx +++ b/frontend/src/container/ListOfDashboard/TableComponents/Name.tsx @@ -1,7 +1,6 @@ import { LockFilled } from '@ant-design/icons'; import ROUTES from 'constants/routes'; import history from 'lib/history'; -import { generatePath } from 'react-router-dom'; import { Data } from '..'; import { TableLinkText } from './styles'; @@ -9,12 +8,14 @@ import { TableLinkText } from './styles'; function Name(name: Data['name'], data: Data): JSX.Element { const { id: DashboardId, isLocked } = data; - const onClickHandler = (): void => { - history.push( - generatePath(ROUTES.DASHBOARD, { - dashboardId: DashboardId, - }), - ); + const getLink = (): string => `${ROUTES.ALL_DASHBOARD}/${DashboardId}`; + + const onClickHandler = (event: React.MouseEvent): void => { + if (event.metaKey || event.ctrlKey) { + window.open(getLink(), '_blank'); + } else { + history.push(getLink()); + } }; return (