mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-03 08:33:26 +00:00
chore: address comments
This commit is contained in:
@@ -96,10 +96,20 @@ function AlertDetails(): JSX.Element {
|
||||
return params.get(QueryParams.isTestAlert) === 'true';
|
||||
}, [params]);
|
||||
|
||||
useEffect(() => {
|
||||
const getDocumentTile = useMemo(() => {
|
||||
const alertTitle = alertDetailsResponse?.payload?.data?.alert;
|
||||
document.title = alertTitle || document.title;
|
||||
}, [alertDetailsResponse?.payload?.data?.alert, isRefetching]);
|
||||
if (alertTitle) {
|
||||
return alertTitle;
|
||||
}
|
||||
if (isTestAlert) {
|
||||
return 'Test Alert';
|
||||
}
|
||||
return 'Alert Not Found';
|
||||
}, [alertDetailsResponse?.payload?.data?.alert, isTestAlert]);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = getDocumentTile;
|
||||
}, [getDocumentTile]);
|
||||
|
||||
const alertRuleDetails = useMemo(
|
||||
() => alertDetailsResponse?.payload?.data as PostableAlertRuleV2 | undefined,
|
||||
|
||||
@@ -66,18 +66,20 @@ describe('AlertNotFound', () => {
|
||||
});
|
||||
|
||||
it('should navigate to the list all alerts page when the check all rules button is clicked', async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<AlertNotFound isTestAlert={false} />);
|
||||
await userEvent.click(screen.getByText('Check all rules'));
|
||||
await user.click(screen.getByText('Check all rules'));
|
||||
expect(mockSafeNavigate).toHaveBeenCalledWith(ROUTES.LIST_ALL_ALERT);
|
||||
});
|
||||
|
||||
it('should navigate to the correct support page for cloud users when button is clicked', async () => {
|
||||
const user = userEvent.setup();
|
||||
useGetTenantLicenseSpy.mockReturnValueOnce({
|
||||
isCloudUser: true,
|
||||
} as ReturnType<typeof useGetTenantLicense.useGetTenantLicense>);
|
||||
|
||||
render(<AlertNotFound isTestAlert={false} />);
|
||||
await userEvent.click(screen.getByText('Contact Support'));
|
||||
await user.click(screen.getByText('Contact Support'));
|
||||
expect(history.push).toHaveBeenCalledWith('/support');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user