From 55184724d0f93ab5160c9e1261db9b436a22ff7c Mon Sep 17 00:00:00 2001 From: nikhil2004 Date: Tue, 22 Sep 2026 04:41:58 +0530 Subject: [PATCH] fix: resolve failing CI checks --- .../Status/themes/shared/IncidentModal.tsx | 8 +++++++- .../Status/themes/shared/ThemedHeatmap.tsx | 11 ++++++----- .../Status/themes/shared/ThemedHistogram.tsx | 11 ++++++----- .../Pages/StatusPage/Status/themes/shared/sx.ts | 16 ++++++++++++++++ server/src/domain/incidents/incident.type.ts | 5 ++++- .../domain/status-pages/status-page.service.ts | 1 - .../test/unit/services/statusPageService.test.ts | 4 ++-- 7 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 client/src/Pages/StatusPage/Status/themes/shared/sx.ts diff --git a/client/src/Pages/StatusPage/Status/themes/shared/IncidentModal.tsx b/client/src/Pages/StatusPage/Status/themes/shared/IncidentModal.tsx index ed3f5f33d..c96d947bf 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/IncidentModal.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/IncidentModal.tsx @@ -27,7 +27,13 @@ interface IncidentModalProps { onClose: () => void; } -export const IncidentModal = ({ url, monitorId, date, timezone, onClose }: IncidentModalProps) => { +export const IncidentModal = ({ + url, + monitorId, + date, + timezone, + onClose, +}: IncidentModalProps) => { const theme = useTheme(); const { t } = useTranslation(); const open = Boolean(monitorId && date); diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx index e213b097e..650fa135c 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx @@ -2,6 +2,7 @@ import Tooltip from "@mui/material/Tooltip"; import Box from "@mui/material/Box"; import type { SxProps, Theme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; +import { mergeSx } from "@/Pages/StatusPage/Status/themes/shared/sx"; import type { ChartCell, @@ -20,7 +21,7 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props return ( @@ -29,10 +30,10 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props return ( { if (cell.date && onCellClick) { onCellClick(cell.date); @@ -49,10 +50,10 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props placement="top" > { if (cell.date && onCellClick) { diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx index a5ea74d0e..82c4c97bb 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx @@ -5,6 +5,7 @@ import Stack from "@mui/material/Stack"; import type { SxProps, Theme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; import { formatMs } from "@/Utils/TimeUtils"; +import { mergeSx } from "@/Pages/StatusPage/Status/themes/shared/sx"; import type { BarKind, @@ -42,17 +43,17 @@ export const ThemedHistogram = ({ return ( {cells.map((cell) => { if (cell.barKind === "empty") { return ( { if (cell.date && onCellClick) { onCellClick(cell.date); @@ -69,10 +70,10 @@ export const ThemedHistogram = ({ placement="top" > { if (cell.date && onCellClick) { diff --git a/client/src/Pages/StatusPage/Status/themes/shared/sx.ts b/client/src/Pages/StatusPage/Status/themes/shared/sx.ts new file mode 100644 index 000000000..aa2dd0c41 --- /dev/null +++ b/client/src/Pages/StatusPage/Status/themes/shared/sx.ts @@ -0,0 +1,16 @@ +import type { SxProps, Theme } from "@mui/material/styles"; + +export const mergeSx = ( + ...styles: Array | false | null | undefined> +): SxProps => { + const result: SxProps[] = []; + for (const style of styles) { + if (!style) continue; + if (Array.isArray(style)) { + result.push(...(style.filter(Boolean) as SxProps[])); + } else { + result.push(style); + } + } + return result as SxProps; +}; diff --git a/server/src/domain/incidents/incident.type.ts b/server/src/domain/incidents/incident.type.ts index bdbc71ccb..8b024969d 100644 --- a/server/src/domain/incidents/incident.type.ts +++ b/server/src/domain/incidents/incident.type.ts @@ -20,7 +20,10 @@ export interface Incident { updatedAt: string; } -export type PublicIncident = Pick; +export type PublicIncident = Pick< + Incident, + "id" | "monitorId" | "status" | "startTime" | "endTime" | "resolutionType" | "message" | "statusCode" | "createdAt" +>; export interface IncidentSummaryTopMonitor { monitorId: string; diff --git a/server/src/domain/status-pages/status-page.service.ts b/server/src/domain/status-pages/status-page.service.ts index 079fa8981..fe696fde6 100644 --- a/server/src/domain/status-pages/status-page.service.ts +++ b/server/src/domain/status-pages/status-page.service.ts @@ -117,7 +117,6 @@ export class StatusPageService implements IStatusPageService { createdAt: incident.createdAt, }); - createStatusPage = async ( userId: string, teamId: string, diff --git a/server/test/unit/services/statusPageService.test.ts b/server/test/unit/services/statusPageService.test.ts index 0c0c11c40..6351e5c14 100644 --- a/server/test/unit/services/statusPageService.test.ts +++ b/server/test/unit/services/statusPageService.test.ts @@ -449,7 +449,7 @@ describe("StatusPageService", () => { it("fetches and sanitizes incidents successfully", async () => { const { service, repo, incidentsRepo } = createService(); (repo.findByUrl as jest.Mock).mockResolvedValue(publishedPage()); - + const mockIncident = { id: "inc-1", monitorId: "mon-1", @@ -466,7 +466,7 @@ describe("StatusPageService", () => { (incidentsRepo.findByMonitorIdAndDate as jest.Mock).mockResolvedValue([mockIncident]); const results = await service.getPublicMonitorIncidents("my-status-page", "mon-1", "2026-08-01"); - + expect(incidentsRepo.findByMonitorIdAndDate).toHaveBeenCalled(); expect(results).toHaveLength(1); expect(results[0]).toHaveProperty("id", "inc-1");