From 86a74a6107e58ec0364408081bdd9f6a96780afa Mon Sep 17 00:00:00 2001 From: nishantharcot Date: Tue, 24 Dec 2024 13:41:49 +0530 Subject: [PATCH] feat: update page titles for dashboards and alerts --- frontend/src/pages/AlertDetails/AlertDetails.tsx | 3 +++ frontend/src/pages/NewDashboard/DashboardPage.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/frontend/src/pages/AlertDetails/AlertDetails.tsx b/frontend/src/pages/AlertDetails/AlertDetails.tsx index 5ee95dfce24..4f6d70466ed 100644 --- a/frontend/src/pages/AlertDetails/AlertDetails.tsx +++ b/frontend/src/pages/AlertDetails/AlertDetails.tsx @@ -80,6 +80,9 @@ function AlertDetails(): JSX.Element { alertDetailsResponse, } = useGetAlertRuleDetails(); + const alertTitle = alertDetailsResponse?.payload?.data.alert; + document.title = alertTitle || document.title; + if ( isError || !isValidRuleId || diff --git a/frontend/src/pages/NewDashboard/DashboardPage.tsx b/frontend/src/pages/NewDashboard/DashboardPage.tsx index 7da194aad07..5118cf3ad3b 100644 --- a/frontend/src/pages/NewDashboard/DashboardPage.tsx +++ b/frontend/src/pages/NewDashboard/DashboardPage.tsx @@ -17,6 +17,9 @@ function DashboardPage(): JSX.Element { (dashboardResponse?.error as AxiosError)?.response?.data?.errorType : 'Something went wrong'; + const dashboardTitle = dashboardResponse.data?.data.title; + document.title = dashboardTitle || document.title; + if (isError && !isFetching && errorMessage === ErrorType.NotFound) { return ; }