mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 20:29:04 +08:00
fix(ruler): improve the user experience for rule id migration (#7841)
* fix(ruler): improve the user experience for rule id migration * fix(ruler): improve the user experience for rule id migration
This commit is contained in:
parent
b80626f5e2
commit
3648027576
@ -531,6 +531,7 @@ export const oldRoutes = [
|
|||||||
'/traces-save-views',
|
'/traces-save-views',
|
||||||
'/settings/access-tokens',
|
'/settings/access-tokens',
|
||||||
'/messaging-queues',
|
'/messaging-queues',
|
||||||
|
'/alerts/edit',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const oldNewRoutesMapping: Record<string, string> = {
|
export const oldNewRoutesMapping: Record<string, string> = {
|
||||||
@ -541,6 +542,7 @@ export const oldNewRoutesMapping: Record<string, string> = {
|
|||||||
'/traces-save-views': '/traces/saved-views',
|
'/traces-save-views': '/traces/saved-views',
|
||||||
'/settings/access-tokens': '/settings/api-keys',
|
'/settings/access-tokens': '/settings/api-keys',
|
||||||
'/messaging-queues': '/messaging-queues/overview',
|
'/messaging-queues': '/messaging-queues/overview',
|
||||||
|
'/alerts/edit': '/alerts/overview',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ROUTES_NOT_TO_BE_OVERRIDEN: string[] = [
|
export const ROUTES_NOT_TO_BE_OVERRIDEN: string[] = [
|
||||||
|
@ -6,7 +6,11 @@ import { Filters } from 'components/AlertDetailsFilters/Filters';
|
|||||||
import NotFound from 'components/NotFound';
|
import NotFound from 'components/NotFound';
|
||||||
import RouteTab from 'components/RouteTab';
|
import RouteTab from 'components/RouteTab';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
|
import { QueryParams } from 'constants/query';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
|
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||||
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { useEffect, useMemo } from 'react';
|
import { useEffect, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -70,6 +74,9 @@ BreadCrumbItem.defaultProps = {
|
|||||||
function AlertDetails(): JSX.Element {
|
function AlertDetails(): JSX.Element {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
const { routes } = useRouteTabUtils();
|
const { routes } = useRouteTabUtils();
|
||||||
|
const urlQuery = useUrlQuery();
|
||||||
|
const { safeNavigate } = useSafeNavigate();
|
||||||
|
const { notifications } = useNotifications();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
@ -85,6 +92,27 @@ function AlertDetails(): JSX.Element {
|
|||||||
document.title = alertTitle || document.title;
|
document.title = alertTitle || document.title;
|
||||||
}, [alertDetailsResponse?.payload?.data.alert, isRefetching]);
|
}, [alertDetailsResponse?.payload?.data.alert, isRefetching]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (alertDetailsResponse?.payload?.data?.id) {
|
||||||
|
const ruleUUID = alertDetailsResponse.payload.data.id;
|
||||||
|
if (ruleId !== ruleUUID) {
|
||||||
|
urlQuery.set(QueryParams.ruleId, ruleUUID);
|
||||||
|
const generatedUrl = `${window.location.pathname}?${urlQuery}`;
|
||||||
|
notifications.info({
|
||||||
|
message:
|
||||||
|
"We're transitioning alert rule IDs from integers to UUIDs.Both old and new alert links will continue to work after this change - existing notifications using integer IDs will remain functional while new alerts will use the UUID format. Please use the updated link in the URL for future references",
|
||||||
|
});
|
||||||
|
safeNavigate(generatedUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
alertDetailsResponse?.payload?.data.id,
|
||||||
|
notifications,
|
||||||
|
ruleId,
|
||||||
|
safeNavigate,
|
||||||
|
urlQuery,
|
||||||
|
]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isError ||
|
isError ||
|
||||||
!isValidRuleId ||
|
!isValidRuleId ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user