fix: use override method on alerts and overview

This commit is contained in:
manika-signoz 2025-09-11 01:56:28 +05:30
parent 1f2db8bf4b
commit eaaf244ab1
3 changed files with 11 additions and 37 deletions

View File

@ -21,20 +21,12 @@ function AlertChannels({ allChannels }: AlertChannelsProps): JSX.Element {
const [action] = useComponentPermission(['new_alert_action'], user.role);
const onClickEditHandler = useCallback((id: string, e: React.MouseEvent) => {
if (e.metaKey || e.ctrlKey) {
window.open(
generatePath(ROUTES.CHANNELS_EDIT, {
channelId: id,
}),
'_blank',
);
} else {
history.push(
generatePath(ROUTES.CHANNELS_EDIT, {
channelId: id,
}),
);
}
history.push(
generatePath(ROUTES.CHANNELS_EDIT, {
channelId: id,
}),
e,
);
}, []);
const columns: ColumnsType<Channels> = [

View File

@ -38,11 +38,7 @@ export function AlertsEmptyState(): JSX.Element {
const onClickNewAlertHandler = useCallback((e: React.MouseEvent) => {
setLoading(false);
if (e.metaKey || e.ctrlKey) {
window.open(ROUTES.ALERTS_NEW, '_blank');
} else {
history.push(ROUTES.ALERTS_NEW);
}
history.push(ROUTES.ALERTS_NEW, e);
}, []);
return (

View File

@ -235,7 +235,7 @@ function Application(): JSX.Element {
timestamp: number,
apmToTraceQuery: Query,
isViewLogsClicked?: boolean,
openInNewTab?: boolean,
e?: React.MouseEvent,
): (() => void) => (): void => {
// eslint-disable-line @typescript-eslint/no-explicit-any
const endTime = secondsToMilliseconds(timestamp);
@ -261,11 +261,7 @@ function Application(): JSX.Element {
queryString,
);
if (openInNewTab) {
window.open(newPath, '_blank');
} else {
history.push(newPath);
}
history.push(newPath, e);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[stepInterval],
@ -385,20 +381,10 @@ function Application(): JSX.Element {
<GraphControlsPanel
id="Error_button"
onViewLogsClick={(e: React.MouseEvent): void =>
onErrorTrackHandler(
selectedTimeStamp,
logErrorQuery,
undefined,
e.metaKey || e.ctrlKey,
)()
onErrorTrackHandler(selectedTimeStamp, logErrorQuery, undefined, e)()
}
onViewTracesClick={(e: React.MouseEvent): void =>
onErrorTrackHandler(
selectedTimeStamp,
errorTrackQuery,
undefined,
e.metaKey || e.ctrlKey,
)()
onErrorTrackHandler(selectedTimeStamp, errorTrackQuery, undefined, e)()
}
/>