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 [action] = useComponentPermission(['new_alert_action'], user.role);
const onClickEditHandler = useCallback((id: string, e: React.MouseEvent) => { 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( history.push(
generatePath(ROUTES.CHANNELS_EDIT, { generatePath(ROUTES.CHANNELS_EDIT, {
channelId: id, channelId: id,
}), }),
e,
); );
}
}, []); }, []);
const columns: ColumnsType<Channels> = [ const columns: ColumnsType<Channels> = [

View File

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

View File

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