From d971573db021a0138d047bc2449f003a6d9a43a9 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Thu, 5 Feb 2026 12:48:13 +0000 Subject: [PATCH] Refactor code for improved readability and consistency - Adjusted formatting in PublicNote.tsx for better alignment of imports and function parameters. - Reformatted episode monitor extraction in Detail.tsx for clarity. - Enhanced readability of episodes data parsing in List.tsx. --- Common/Server/API/StatusPageAPI.ts | 299 ++++-- Common/UI/Components/Icon/Icon.tsx | 996 +++++++++++++++--- .../Incidents/EpisodeView/PublicNote.tsx | 11 +- StatusPage/src/Pages/Incidents/Detail.tsx | 13 +- StatusPage/src/Pages/Incidents/List.tsx | 3 +- 5 files changed, 1036 insertions(+), 286 deletions(-) diff --git a/Common/Server/API/StatusPageAPI.ts b/Common/Server/API/StatusPageAPI.ts index b99b13557e..f6fca9e2ee 100644 --- a/Common/Server/API/StatusPageAPI.ts +++ b/Common/Server/API/StatusPageAPI.ts @@ -1608,26 +1608,31 @@ export default class StatusPageAPI extends BaseAPI< let episodePublicNotes: Array = []; let episodeStateTimelines: Array = []; - if (statusPage.showEpisodesOnStatusPage && monitorsOnStatusPage.length > 0) { + if ( + statusPage.showEpisodesOnStatusPage && + monitorsOnStatusPage.length > 0 + ) { // First, get incidents that have monitors on status page - const incidentsForEpisodes: Array = await IncidentService.findBy({ - query: { - monitors: monitorsOnStatusPage as any, - projectId: statusPage.projectId!, - }, - select: { - _id: true, - }, - skip: 0, - limit: LIMIT_PER_PROJECT, - props: { - isRoot: true, - }, - }); + const incidentsForEpisodes: Array = + await IncidentService.findBy({ + query: { + monitors: monitorsOnStatusPage as any, + projectId: statusPage.projectId!, + }, + select: { + _id: true, + }, + skip: 0, + limit: LIMIT_PER_PROJECT, + props: { + isRoot: true, + }, + }); - const incidentIdsForEpisodes: Array = incidentsForEpisodes.map( - (incident: Incident) => incident.id! - ); + const incidentIdsForEpisodes: Array = + incidentsForEpisodes.map((incident: Incident) => { + return incident.id!; + }); // Get episode members for these incidents let episodeMembers: Array = []; @@ -1666,7 +1671,9 @@ export default class StatusPageAPI extends BaseAPI< ); const unresolvedIncidentStateIds: Array = - unresolvedIncidentStates.map((state: IncidentState) => state.id!); + unresolvedIncidentStates.map((state: IncidentState) => { + return state.id!; + }); let selectEpisodes: Select = { createdAt: true, @@ -1705,9 +1712,13 @@ export default class StatusPageAPI extends BaseAPI< activeEpisodes = await IncidentEpisodeService.findBy({ query: { _id: QueryHelper.any( - Array.from(episodeIdsFromMembers).map((id: string) => new ObjectID(id)), + Array.from(episodeIdsFromMembers).map((id: string) => { + return new ObjectID(id); + }), + ), + currentIncidentStateId: QueryHelper.any( + unresolvedIncidentStateIds, ), - currentIncidentStateId: QueryHelper.any(unresolvedIncidentStateIds), isVisibleOnStatusPage: true, projectId: statusPage.projectId!, }, @@ -1727,7 +1738,9 @@ export default class StatusPageAPI extends BaseAPI< if (activeEpisodes.length > 0) { // Collect all incident IDs from episode members for active episodes const activeEpisodeIds: Set = new Set( - activeEpisodes.map((e: IncidentEpisode) => e.id!.toString()) + activeEpisodes.map((e: IncidentEpisode) => { + return e.id!.toString(); + }), ); const memberIncidentIds: Array = []; @@ -1736,7 +1749,9 @@ export default class StatusPageAPI extends BaseAPI< member.incidentEpisodeId && activeEpisodeIds.has(member.incidentEpisodeId.toString()) && member.incidentId && - !memberIncidentIds.some((id: ObjectID) => id.toString() === member.incidentId!.toString()) + !memberIncidentIds.some((id: ObjectID) => { + return id.toString() === member.incidentId!.toString(); + }) ) { memberIncidentIds.push(member.incidentId); } @@ -1765,31 +1780,54 @@ export default class StatusPageAPI extends BaseAPI< } // Build incident -> monitors map - const incidentMonitorsMap: Map> = new Map(); + const incidentMonitorsMap: Map< + string, + Array + > = new Map(); for (const incident of memberIncidents) { const incidentIdStr: string = incident.id!.toString(); const monitorIds: Array = (incident.monitors || []) - .map((m: Monitor) => new ObjectID(m._id?.toString() || m.id?.toString() || "")) - .filter((id: ObjectID) => id.toString() !== ""); + .map((m: Monitor) => { + return new ObjectID( + m._id?.toString() || m.id?.toString() || "", + ); + }) + .filter((id: ObjectID) => { + return id.toString() !== ""; + }); incidentMonitorsMap.set(incidentIdStr, monitorIds); } // Build episode -> monitors map - const episodeMonitorsMap: Map> = new Map(); + const episodeMonitorsMap: Map< + string, + Array + > = new Map(); for (const member of episodeMembers) { - if (member.incidentEpisodeId && member.incidentId && activeEpisodeIds.has(member.incidentEpisodeId.toString())) { - const episodeIdStr: string = member.incidentEpisodeId.toString(); + if ( + member.incidentEpisodeId && + member.incidentId && + activeEpisodeIds.has(member.incidentEpisodeId.toString()) + ) { + const episodeIdStr: string = + member.incidentEpisodeId.toString(); const incidentIdStr: string = member.incidentId.toString(); if (!episodeMonitorsMap.has(episodeIdStr)) { episodeMonitorsMap.set(episodeIdStr, []); } - const episodeMonitors: Array = episodeMonitorsMap.get(episodeIdStr)!; - const incidentMonitors: Array = incidentMonitorsMap.get(incidentIdStr) || []; + const episodeMonitors: Array = + episodeMonitorsMap.get(episodeIdStr)!; + const incidentMonitors: Array = + incidentMonitorsMap.get(incidentIdStr) || []; for (const monitorId of incidentMonitors) { - if (!episodeMonitors.some((m: ObjectID) => m.toString() === monitorId.toString())) { + if ( + !episodeMonitors.some((m: ObjectID) => { + return m.toString() === monitorId.toString(); + }) + ) { episodeMonitors.push(monitorId); } } @@ -1797,74 +1835,86 @@ export default class StatusPageAPI extends BaseAPI< } // Serialize episodes and add monitors - activeEpisodesJson = BaseModel.toJSONArray(activeEpisodes, IncidentEpisode); + activeEpisodesJson = BaseModel.toJSONArray( + activeEpisodes, + IncidentEpisode, + ); for (const episodeJson of activeEpisodesJson) { const episodeObj: JSONObject = episodeJson as JSONObject; - const episodeId: string | undefined = episodeObj["_id"]?.toString(); + const episodeId: string | undefined = + episodeObj["_id"]?.toString(); if (episodeId) { - const monitorIds: Array = episodeMonitorsMap.get(episodeId) || []; - episodeObj["monitors"] = monitorIds.map((id: ObjectID) => ({ _id: id.toString() })); + const monitorIds: Array = + episodeMonitorsMap.get(episodeId) || []; + episodeObj["monitors"] = monitorIds.map((id: ObjectID) => { + return { _id: id.toString() }; + }); } } // Get episode public notes - const episodesOnStatusPage: Array = activeEpisodes.map( - (episode: IncidentEpisode) => episode.id! - ); + const episodesOnStatusPage: Array = + activeEpisodes.map((episode: IncidentEpisode) => { + return episode.id!; + }); if (episodesOnStatusPage.length > 0) { - episodePublicNotes = await IncidentEpisodePublicNoteService.findBy({ - query: { - incidentEpisodeId: QueryHelper.any(episodesOnStatusPage), - projectId: statusPage.projectId!, - }, - select: { - postedAt: true, - note: true, - incidentEpisodeId: true, - attachments: { - _id: true, - name: true, + episodePublicNotes = + await IncidentEpisodePublicNoteService.findBy({ + query: { + incidentEpisodeId: + QueryHelper.any(episodesOnStatusPage), + projectId: statusPage.projectId!, }, - }, - sort: { - postedAt: SortOrder.Descending, - }, - skip: 0, - limit: LIMIT_PER_PROJECT, - props: { - isRoot: true, - }, - }); + select: { + postedAt: true, + note: true, + incidentEpisodeId: true, + attachments: { + _id: true, + name: true, + }, + }, + sort: { + postedAt: SortOrder.Descending, + }, + skip: 0, + limit: LIMIT_PER_PROJECT, + props: { + isRoot: true, + }, + }); // Get episode state timelines - episodeStateTimelines = await IncidentEpisodeStateTimelineService.findBy({ - query: { - incidentEpisodeId: QueryHelper.any(episodesOnStatusPage), - projectId: statusPage.projectId!, - }, - select: { - _id: true, - createdAt: true, - startsAt: true, - incidentEpisodeId: true, - incidentState: { - name: true, - color: true, - isCreatedState: true, - isAcknowledgedState: true, - isResolvedState: true, + episodeStateTimelines = + await IncidentEpisodeStateTimelineService.findBy({ + query: { + incidentEpisodeId: + QueryHelper.any(episodesOnStatusPage), + projectId: statusPage.projectId!, }, - }, - sort: { - startsAt: SortOrder.Descending, - }, - skip: 0, - limit: LIMIT_PER_PROJECT, - props: { - isRoot: true, - }, - }); + select: { + _id: true, + createdAt: true, + startsAt: true, + incidentEpisodeId: true, + incidentState: { + name: true, + color: true, + isCreatedState: true, + isAcknowledgedState: true, + isResolvedState: true, + }, + }, + sort: { + startsAt: SortOrder.Descending, + }, + skip: 0, + limit: LIMIT_PER_PROJECT, + props: { + isRoot: true, + }, + }); } } } @@ -4039,10 +4089,15 @@ export default class StatusPageAPI extends BaseAPI< // Merge with existing episode members for (const member of episodeMembersForSpecificEpisode) { - if (!episodeMembers.some((m: IncidentEpisodeMember) => - m.incidentEpisodeId?.toString() === member.incidentEpisodeId?.toString() && - m.incidentId?.toString() === member.incidentId?.toString() - )) { + if ( + !episodeMembers.some((m: IncidentEpisodeMember) => { + return ( + m.incidentEpisodeId?.toString() === + member.incidentEpisodeId?.toString() && + m.incidentId?.toString() === member.incidentId?.toString() + ); + }) + ) { episodeMembers.push(member); } } @@ -4150,11 +4205,18 @@ export default class StatusPageAPI extends BaseAPI< }, ); - // Build a map of episode ID -> monitor IDs from episode members - // Collect all unique incident IDs from episode members + /* + * Build a map of episode ID -> monitor IDs from episode members + * Collect all unique incident IDs from episode members + */ const memberIncidentIds: Array = []; for (const member of episodeMembers) { - if (member.incidentId && !memberIncidentIds.some((id: ObjectID) => id.toString() === member.incidentId!.toString())) { + if ( + member.incidentId && + !memberIncidentIds.some((id: ObjectID) => { + return id.toString() === member.incidentId!.toString(); + }) + ) { memberIncidentIds.push(member.incidentId); } } @@ -4185,9 +4247,13 @@ export default class StatusPageAPI extends BaseAPI< const incidentMonitorsMap: Map> = new Map(); for (const incident of memberIncidents) { const incidentIdStr: string = incident.id!.toString(); - const monitorIds: Array = (incident.monitors || []).map((m: Monitor) => { - return new ObjectID(m._id?.toString() || m.id?.toString() || ""); - }).filter((id: ObjectID) => id.toString() !== ""); + const monitorIds: Array = (incident.monitors || []) + .map((m: Monitor) => { + return new ObjectID(m._id?.toString() || m.id?.toString() || ""); + }) + .filter((id: ObjectID) => { + return id.toString() !== ""; + }); incidentMonitorsMap.set(incidentIdStr, monitorIds); } @@ -4202,11 +4268,17 @@ export default class StatusPageAPI extends BaseAPI< episodeMonitorsMap.set(episodeIdStr, []); } - const episodeMonitors: Array = episodeMonitorsMap.get(episodeIdStr)!; - const incidentMonitors: Array = incidentMonitorsMap.get(incidentIdStr) || []; + const episodeMonitors: Array = + episodeMonitorsMap.get(episodeIdStr)!; + const incidentMonitors: Array = + incidentMonitorsMap.get(incidentIdStr) || []; for (const monitorId of incidentMonitors) { - if (!episodeMonitors.some((m: ObjectID) => m.toString() === monitorId.toString())) { + if ( + !episodeMonitors.some((m: ObjectID) => { + return m.toString() === monitorId.toString(); + }) + ) { episodeMonitors.push(monitorId); } } @@ -4293,13 +4365,19 @@ export default class StatusPageAPI extends BaseAPI< }); // Serialize episodes and add monitors to each - const episodesJson: JSONArray = BaseModel.toJSONArray(episodes, IncidentEpisode); + const episodesJson: JSONArray = BaseModel.toJSONArray( + episodes, + IncidentEpisode, + ); for (const episodeJson of episodesJson) { const episodeObj: JSONObject = episodeJson as JSONObject; const episodeId: string | undefined = episodeObj["_id"]?.toString(); if (episodeId) { - const monitorIds: Array = episodeMonitorsMap.get(episodeId) || []; - episodeObj["monitors"] = monitorIds.map((id: ObjectID) => ({ _id: id.toString() })); + const monitorIds: Array = + episodeMonitorsMap.get(episodeId) || []; + episodeObj["monitors"] = monitorIds.map((id: ObjectID) => { + return { _id: id.toString() }; + }); } } @@ -5043,12 +5121,7 @@ export default class StatusPageAPI extends BaseAPI< const noteIdParam: string | undefined = req.params["noteId"]; const fileIdParam: string | undefined = req.params["fileId"]; - if ( - !statusPageIdParam || - !episodeIdParam || - !noteIdParam || - !fileIdParam - ) { + if (!statusPageIdParam || !episodeIdParam || !noteIdParam || !fileIdParam) { throw new NotFoundException("Attachment not found"); } @@ -5124,8 +5197,12 @@ export default class StatusPageAPI extends BaseAPI< } const incidentIds: Array = episodeMembers - .map((member: IncidentEpisodeMember) => member.incidentId) - .filter((id: ObjectID | undefined): id is ObjectID => Boolean(id)); + .map((member: IncidentEpisodeMember) => { + return member.incidentId; + }) + .filter((id: ObjectID | undefined): id is ObjectID => { + return Boolean(id); + }); // Check if any of the incidents are linked to monitors on the status page const incident: Incident | null = await IncidentService.findOneBy({ diff --git a/Common/UI/Components/Icon/Icon.tsx b/Common/UI/Components/Icon/Icon.tsx index 9192a1ba53..57469b69aa 100644 --- a/Common/UI/Components/Icon/Icon.tsx +++ b/Common/UI/Components/Icon/Icon.tsx @@ -1403,367 +1403,731 @@ const Icon: FunctionComponent = ({ ); } else if (icon === IconProp.ArrowDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowUp) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowLeft) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowRight) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowPath) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowTrendingUp) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowTrendingDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowUturnLeft) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ArrowUturnRight) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Beaker) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Bookmark) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BookmarkSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Briefcase) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BuildingOffice) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Cake) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Calculator) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Camera) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Cloud) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CloudArrowDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CloudArrowUp) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Cog || icon === IconProp.Cog6Tooth) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Cog8Tooth) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CommandLine) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ComputerDesktop) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CreditCard) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CurrencyDollar) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DevicePhoneMobile) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DeviceTablet) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Document) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentArrowDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentArrowUp) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentDuplicate) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentMagnifyingGlass) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentMinus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentPlus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentText) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.EllipsisHorizontal) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.EllipsisVertical) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Envelope) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.EnvelopeOpen) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Eye) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FaceFrown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FaceSmile) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Film) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Fingerprint) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Fire) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FolderMinus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FolderOpen) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FolderPlus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Forward) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Funnel) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Gift) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.GlobeAlt) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.HandThumbUp) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.HandThumbDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.HandRaised) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Hashtag) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Heart) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Identification) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Inbox) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.InboxArrowDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.InboxStack) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.InformationCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Language) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Lifebuoy) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.LightBulb) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.LinkSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.LockOpen) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MagnifyingGlass) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MagnifyingGlassCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MagnifyingGlassMinus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MagnifyingGlassPlus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Map) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MapPin) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Megaphone) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Microphone) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Moon) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MusicalNote) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Newspaper) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.NoSymbol) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PaintBrush) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PaperAirplane) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PaperClip) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Pause) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PauseCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PencilSquare) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Percent) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Phone) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Photo) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PlayCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PlusCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PlusSmall) { return getSvgWrapper( @@ -1771,303 +2135,603 @@ const Icon: FunctionComponent = ({ ); } else if (icon === IconProp.Power) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PresentationChartBar) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PresentationChartLine) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Printer) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PuzzlePiece) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.QrCode) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.QuestionMarkCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.QueueList) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Radio) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.RocketLaunch) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Scale) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Scissors) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Server) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ServerStack) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Share) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ShieldExclamation) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ShoppingBag) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ShoppingCart) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.SignalSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Sparkles) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.SpeakerWave) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.SpeakerXMark) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Square2Stack) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.StopCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Sun) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Tag) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Ticket) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Trophy) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Truck) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Tv) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Upload) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.UserCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.UserGroup) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.UserMinus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.UserPlus) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.VideoCamera) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.VideoCameraSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ViewColumns) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ViewfinderCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Wallet) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Wifi) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.XMark) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.XCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.MinusCircle) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Backward) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Bars2) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Bars4) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BellAlert) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BellSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BoltSlash) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.BookOpen) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ChatBubbleLeft) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ChatBubbleLeftRight) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ChatBubbleOvalLeft) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ChatBubbleOvalLeftEllipsis) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Clipboard) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ClipboardDocument) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ClipboardDocumentCheck) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ClipboardDocumentList) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.CheckBadge) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ChartBarSquare) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.DocumentChartBar) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.FolderArrowDown) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.GlobeAmericas) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.GlobeAsiaAustralia) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.GlobeEuropeAfrica) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.HomeModern) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PhoneArrowDownLeft) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PhoneArrowUpRight) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PhoneXMark) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.PlayPause) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ReceiptPercent) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.ReceiptRefund) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.Strikethrough) { return getSvgWrapper( - , + , ); } else if (icon === IconProp.EyeDropper) { return getSvgWrapper( - , + , ); } diff --git a/Dashboard/src/Pages/Incidents/EpisodeView/PublicNote.tsx b/Dashboard/src/Pages/Incidents/EpisodeView/PublicNote.tsx index 8b7cd2c4bf..a369c5a496 100644 --- a/Dashboard/src/Pages/Incidents/EpisodeView/PublicNote.tsx +++ b/Dashboard/src/Pages/Incidents/EpisodeView/PublicNote.tsx @@ -20,7 +20,12 @@ import User from "Common/Models/DatabaseModels/User"; import StatusPageSubscriberNotificationStatus from "Common/Types/StatusPage/StatusPageSubscriberNotificationStatus"; import SubscriberNotificationStatus from "../../../Components/StatusPageSubscribers/SubscriberNotificationStatus"; import MarkdownViewer from "Common/UI/Components/Markdown.tsx/MarkdownViewer"; -import React, { Fragment, FunctionComponent, ReactElement, useState } from "react"; +import React, { + Fragment, + FunctionComponent, + ReactElement, + useState, +} from "react"; import AttachmentList from "../../../Components/Attachment/AttachmentList"; import { getModelIdString } from "../../../Utils/ModelId"; @@ -33,7 +38,9 @@ const EpisodePublicNote: FunctionComponent = ( const handleResendNotification: ( item: IncidentEpisodePublicNote, - ) => Promise = async (item: IncidentEpisodePublicNote): Promise => { + ) => Promise = async ( + item: IncidentEpisodePublicNote, + ): Promise => { try { await ModelAPI.updateById({ modelType: IncidentEpisodePublicNote, diff --git a/StatusPage/src/Pages/Incidents/Detail.tsx b/StatusPage/src/Pages/Incidents/Detail.tsx index cd5aab3f77..b6507074f1 100644 --- a/StatusPage/src/Pages/Incidents/Detail.tsx +++ b/StatusPage/src/Pages/Incidents/Detail.tsx @@ -394,12 +394,12 @@ export const getEpisodeEventItem: GetEpisodeEventItemFunction = ( : null; // Get monitor IDs from episode (computed by backend from member incidents) - const episodeMonitors: Array<{ _id?: string }> = (episode as any).monitors || []; - const monitorIdsInThisEpisode: Array = episodeMonitors.map( - (monitor: { _id?: string }) => { + const episodeMonitors: Array<{ _id?: string }> = + (episode as any).monitors || []; + const monitorIdsInThisEpisode: Array = + episodeMonitors.map((monitor: { _id?: string }) => { return monitor._id; - }, - ); + }); // Get affected resources from status page resources let namesOfResources: Array = statusPageResources.filter( @@ -745,7 +745,8 @@ const Detail: FunctionComponent = ( (data["episodes"] as JSONArray) || []; if (rawEpisodes.length > 0) { - const rawEpisode: JSONObject = (rawEpisodes[0] as JSONObject) || {}; + const rawEpisode: JSONObject = + (rawEpisodes[0] as JSONObject) || {}; const episode: IncidentEpisode = BaseModel.fromJSONObject( rawEpisode, IncidentEpisode, diff --git a/StatusPage/src/Pages/Incidents/List.tsx b/StatusPage/src/Pages/Incidents/List.tsx index b189103f88..6ff55fbe60 100644 --- a/StatusPage/src/Pages/Incidents/List.tsx +++ b/StatusPage/src/Pages/Incidents/List.tsx @@ -181,7 +181,8 @@ const Overview: FunctionComponent = ( ); // Parse episodes data - const rawEpisodesArray: JSONArray = (episodesData["episodes"] as JSONArray) || []; + const rawEpisodesArray: JSONArray = + (episodesData["episodes"] as JSONArray) || []; const episodes: Array = BaseModel.fromJSONArray( rawEpisodesArray, IncidentEpisode,