Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: open entities in new tab on ctrl / cmd + click (#8607)

Yunus Md7fdbcd90daf
diff --git a/frontend/src/container/ListAlertRules/ListAlert.tsx b/frontend/src/container/ListAlertRules/ListAlert.tsx
index 0850934548..638c210abe 100644
--- a/frontend/src/container/ListAlertRules/ListAlert.tsx
+++ b/frontend/src/container/ListAlertRules/ListAlert.tsx
@@ -105,7 +105,7 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- const onEditHandler = (record: GettableAlert) => (): void => {
+ const onEditHandler = (record: GettableAlert, openInNewTab: boolean): void => {
const compositeQuery = mapQueryDataFromApi(record.condition.compositeQuery);
params.set(
QueryParams.compositeQuery,
@@ -117,7 +117,12 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
params.set(QueryParams.ruleId, record.id.toString());
setEditLoader(false);
- history.push(`${ROUTES.ALERT_OVERVIEW}?${params.toString()}`);
+
+ if (openInNewTab) {
+ window.open(`${ROUTES.ALERT_OVERVIEW}?${params.toString()}`, '_blank');
+ } else {
+ history.push(`${ROUTES.ALERT_OVERVIEW}?${params.toString()}`);
+ }
};
const onCloneHandler = (
@@ -250,9 +255,15 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
}
return 0;
},
- render: (value, record): JSX.Element => (
- <Typography.Link onClick={onEditHandler(record)}>{value}</Typography.Link>
- ),
+ render: (value, record): JSX.Element => {
+ const onClickHandler = (e: React.MouseEvent<HTMLElement>): void => {
+ e.stopPropagation();
+ e.preventDefault();
+ onEditHandler(record, e.metaKey || e.ctrlKey);
+ };
+
+ return <Typography.Link onClick={onClickHandler}>{value}</Typography.Link>;
+ },
sortOrder: sortedInfo.columnKey === 'name' ? sortedInfo.order : null,
},
{
@@ -311,12 +322,20 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
/>,
<ColumnButton
key="2"
- onClick={onEditHandler(record)}
+ onClick={(): void => onEditHandler(record, false)}
type="link"
loading={editLoader}
>
Edit
</ColumnButton>,
+ <ColumnButton
+ key="3"
+ onClick={(): void => onEditHandler(record, true)}
+ type="link"
+ loading={editLoader}
+ >
+ Edit in New Tab
+ </ColumnButton>,
<ColumnButton
key="3"
onClick={onCloneHandler(record)}
diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
index d25f58cd2b..17310607d8 100644
--- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx
+++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx
@@ -57,6 +57,7 @@ import {
Radius,
RotateCw,
Search,
+ SquareArrowOutUpRight,
} from 'lucide-react';
// #TODO: lucide will be removing brand icons like Github in future, in that case we can use simple icons
// see more: https://github.com/lucide-icons/lucide/issues/94
@@ -440,13 +441,7 @@ function DashboardsList(): JSX.Element {
placement="left"
overlayClassName="title-toolip"
>
- <div
- className="title-link"
- onClick={(e): void => {
- e.stopPropagation();
- safeNavigate(getLink());
- }}
- >
+ <div className="title-link" onClick={onClickHandler}>
<img
src={dashboard?.image || Base64Icons[0]}
alt="dashboard-image"
@@ -494,6 +489,18 @@ function DashboardsList(): JSX.Element {
>
View
</Button>
+ <Button
+ type="text"
+ className="action-btn"
+ icon={<SquareArrowOutUpRight size={12} />}
+ onClick={(e): void => {
+ e.stopPropagation();
+ e.preventDefault();
+ window.open(getLink(), '_blank');
+ }}
+ >
+ Open in New Tab
+ </Button>
<Button
type="text"
className="action-btn"
diff --git a/frontend/src/container/ListOfDashboard/RequestDashboardBtn.tsx b/frontend/src/container/ListOfDashboard/RequestDashboardBtn.tsx
index 756dc953e3..72a602b467 100644
--- a/frontend/src/container/ListOfDashboard/RequestDashboardBtn.tsx
+++ b/frontend/src/container/ListOfDashboard/RequestDashboardBtn.tsx
@@ -65,7 +65,7 @@ export function RequestDashboardBtn(): JSX.Element {
>
Browse dashboard templates
</a>{' '}
- or Request new template →
+ or request a new template →
</Typography.Text>
<div className="form-section">
diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/TableRenderer/ColumnWithLink.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/TableRenderer/ColumnWithLink.tsx
index 87870a6d1e..7005e269ed 100644
--- a/frontend/src/container/MetricsApplication/Tabs/Overview/TableRenderer/ColumnWithLink.tsx
+++ b/frontend/src/container/MetricsApplication/Tabs/Overview/TableRenderer/ColumnWithLink.tsx
@@ -36,7 +36,7 @@ function ColumnWithLink({
],
});
- const handleOnClick = (operation: string) => (): void => {
+ const handleOnClick = (operation: string, openInNewTab: boolean): void => {
navigateToTrace({
servicename,
operation,
@@ -45,12 +45,17 @@ function ColumnWithLink({
selectedTraceTags,
apmToTraceQuery,
safeNavigate,
+ openInNewTab,
});
};
return (
<Tooltip placement="topLeft" title={text}>
- <Typography.Link onClick={handleOnClick(text)}>{text}</Typography.Link>
+ <Typography.Link
+ onClick={(e): void => handleOnClick(text, e.metaKey || e.ctrlKey)}
+ >
+ {text}
+ </Typography.Link>
</Tooltip>
);
}
diff --git a/frontend/src/container/MetricsApplication/TopOperationsTable.tsx b/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
index f0bccab5ac..51b7fc7627 100644
--- a/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
+++ b/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
@@ -50,7 +50,7 @@ function TopOperationsTable({
const params = useParams<{ servicename: string }>();
- const handleOnClick = (operation: string): void => {
+ const handleOnClick = (operation: string, openInNewTab: boolean): void => {
const { servicename: encodedServiceName } = params;
const servicename = decodeURIComponent(encodedServiceName);
@@ -92,6 +92,7 @@ function TopOperationsTable({
selectedTraceTags,
apmToTraceQuery: preparedQuery,
safeNavigate,
+ openInNewTab,
});
};
@@ -110,7 +111,18 @@ function TopOperationsTable({
},
render: (text: string): JSX.Element => (
<Tooltip placement="topLeft" title={text}>
- <Typography.Link onClick={(): void => handleOnClick(text)}>
+ <Typography.Link
+ onClick={(e): void => {
+ e.stopPropagation();
+ e.preventDefault();
+
+ if (e.metaKey || e.ctrlKey) {
+ handleOnClick(text, true); // open in new tab
+ } else {
+ handleOnClick(text, false); // open in current tab
+ }
+ }}
+ >
{text}
</Typography.Link>
</Tooltip>
diff --git a/frontend/src/container/MetricsApplication/types.ts b/frontend/src/container/MetricsApplication/types.ts
index 3229ccfb23..b103281aa2 100644
--- a/frontend/src/container/MetricsApplication/types.ts
+++ b/frontend/src/container/MetricsApplication/types.ts
@@ -22,6 +22,7 @@ export interface NavigateToTraceProps {
selectedTraceTags: string;
apmToTraceQuery: Query;
safeNavigate: (path: string) => void;
+ openInNewTab: boolean;
}
export interface DatabaseCallsRPSProps extends DatabaseCallProps {
diff --git a/frontend/src/container/MetricsApplication/utils.ts b/frontend/src/container/MetricsApplication/utils.ts
index d0e56f242e..00a93e2e08 100644
--- a/frontend/src/container/MetricsApplication/utils.ts
+++ b/frontend/src/container/MetricsApplication/utils.ts
@@ -19,6 +19,7 @@ export const navigateToTrace = ({
selectedTraceTags,
apmToTraceQuery,
safeNavigate,
+ openInNewTab = false,
}: NavigateToTraceProps): void => {
const urlParams = new URLSearchParams();
urlParams.set(
@@ -35,7 +36,11 @@ export const navigateToTrace = ({
QueryParams.compositeQuery
}=${JSONCompositeQuery}`;
- safeNavigate(newTraceExplorerPath);
+ if (openInNewTab) {
+ window.open(newTraceExplorerPath, '_blank');
+ } else {
+ safeNavigate(newTraceExplorerPath);
+ }
};
export const getNearestHighestBucketValue = (