From 60d0f188ad0e888fed1eff694991a977ded87e71 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 2 Nov 2023 19:00:30 +0000 Subject: [PATCH] add categorization to overview --- StatusPage/src/Pages/Overview/Overview.tsx | 119 ++++++++++++--------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/StatusPage/src/Pages/Overview/Overview.tsx b/StatusPage/src/Pages/Overview/Overview.tsx index 3e6900d1fc..5eaf6ac56f 100644 --- a/StatusPage/src/Pages/Overview/Overview.tsx +++ b/StatusPage/src/Pages/Overview/Overview.tsx @@ -49,6 +49,7 @@ import MarkdownViewer from 'CommonUI/src/Components/Markdown.tsx/MarkdownViewer' import StatusPageUtil from '../../Utils/StatusPage'; import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse'; import { STATUS_PAGE_API_URL } from '../../Utils/Config'; +import Section from '../../Components/Section/Section'; const Overview: FunctionComponent = ( props: PageComponentProps @@ -634,6 +635,11 @@ const Overview: FunctionComponent = ( return <>; }; + const activeIncidentsInIncidentGroup: Array = + getActiveIncidents(); + const activeScheduledMaintenanceEventsInScheduledMaintenanceGroup: Array = + getOngoingScheduledEvents(); + return ( {isLoading ? : <>} @@ -675,55 +681,6 @@ const Overview: FunctionComponent = ( )} - {/* Load Active Incident */} -
- {getActiveIncidents().map( - (incidentGroup: IncidentGroup, i: number) => { - return ( - - ); - } - )} -
- - {/* Load Active ScheduledEvent */} -
- {getOngoingScheduledEvents().map( - ( - scheduledEventGroup: ScheduledMaintenanceGroup, - i: number - ) => { - return ( - - ); - } - )} -
-
{currentStatus && statusPageResources.length > 0 && ( = (
{statusPageResources.length > 0 && ( -
+
{statusPageResources.filter( (resources: StatusPageResource) => { @@ -810,8 +767,66 @@ const Overview: FunctionComponent = (
)} - {getActiveIncidents().length === 0 && - getOngoingScheduledEvents().length === 0 && + {/* Load Active Incident */} + {activeIncidentsInIncidentGroup.length > 0 && ( +
+
+ {activeIncidentsInIncidentGroup.map( + (incidentGroup: IncidentGroup, i: number) => { + return ( + + ); + } + )} +
+ )} + + {/* Load Active ScheduledEvent */} + {activeScheduledMaintenanceEventsInScheduledMaintenanceGroup && + activeScheduledMaintenanceEventsInScheduledMaintenanceGroup.length > + 0 && ( +
+
+ {activeScheduledMaintenanceEventsInScheduledMaintenanceGroup.map( + ( + scheduledEventGroup: ScheduledMaintenanceGroup, + i: number + ) => { + return ( + + ); + } + )} +
+ )} + + {activeIncidentsInIncidentGroup.length === 0 && + activeScheduledMaintenanceEventsInScheduledMaintenanceGroup.length === + 0 && statusPageResources.length === 0 && activeAnnouncements.length === 0 && !isLoading &&