Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
Remove ununsed variable and components (#1970)
Moulik Aggarwal40ac0ee9a3b6
diff --git a/apps/dashboard/src/app/(dashboard)/private-locations/page.tsx b/apps/dashboard/src/app/(dashboard)/private-locations/page.tsxindex 961923e4e..445ca7f46 100644--- a/apps/dashboard/src/app/(dashboard)/private-locations/page.tsx+++ b/apps/dashboard/src/app/(dashboard)/private-locations/page.tsx@@ -1,10 +1,5 @@-import type { SearchParams } from "nuqs";import { Client } from "./client";-export default async function Page({- searchParams,-}: {- searchParams: Promise<SearchParams>;-}) {+export default async function Page() {return <Client />;}diff --git a/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx b/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsxindex 866d415fe..03bbcf70f 100644--- a/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx+++ b/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx@@ -84,7 +84,7 @@ export function FormStatusReportUpdateCard({index: number;update: StatusReportUpdate;}) {- const { id, reportId } = useParams<{ id: string; reportId: string }>();+ const { reportId } = useParams<{ id: string; reportId: string }>();const trpc = useTRPC();const { data: workspace } = useQuery(trpc.workspace.getWorkspace.queryOptions(),diff --git a/apps/server/src/routes/rpc/services/status-report/index.ts b/apps/server/src/routes/rpc/services/status-report/index.tsindex bfe379315..07db3a9d2 100644--- a/apps/server/src/routes/rpc/services/status-report/index.ts+++ b/apps/server/src/routes/rpc/services/status-report/index.ts@@ -194,78 +194,76 @@ export const statusReportServiceImpl: ServiceImpl<typeof StatusReportService> =const date = parseDate(req.date);// Create status report, associations, and initial update in a transaction- const {- report: newReport,- newUpdate,- pageId,- } = await db.transaction(async (tx) => {- // Validate page component IDs inside transaction to prevent TOCTOU race condition- const validatedComponents = await validatePageComponentIds(- req.pageComponentIds,- workspaceId,- tx,- );-- // Validate that provided pageId matches the components' page- const derivedPageId = validatedComponents.pageId;- const providedPageId = req.pageId?.trim();- if (- derivedPageId !== null &&- providedPageId &&- providedPageId !== "" &&- Number(providedPageId) !== derivedPageId- ) {- throw pageIdComponentMismatchError(- providedPageId,- String(derivedPageId),- );- }-- // Use the derived pageId from components, or parse the provided one- const pageId =- derivedPageId ?? (providedPageId ? Number(providedPageId) : null);-- // Create the status report- const report = await tx- .insert(statusReport)- .values({+ const { report: newReport, newUpdate } = await db.transaction(+ async (tx) => {+ // Validate page component IDs inside transaction to prevent TOCTOU race condition+ const validatedComponents = await validatePageComponentIds(+ req.pageComponentIds,workspaceId,- pageId,- title: req.title,- status: protoStatusToDb(req.status),- })- .returning()- .get();-- if (!report) {- throw statusReportCreateFailedError();- }-- // Create page component associations- await updatePageComponentAssociations(- report.id,- validatedComponents.componentIds,- tx,- );-- // Create the initial update- const newUpdate = await tx- .insert(statusReportUpdate)- .values({- statusReportId: report.id,- status: protoStatusToDb(req.status),- date,- message: req.message,- })- .returning()- .get();+ tx,+ );- if (!newUpdate) {- throw statusReportCreateFailedError();- }+ // Validate that provided pageId matches the components' page+ const derivedPageId = validatedComponents.pageId;+ const providedPageId = req.pageId?.trim();+ if (+ derivedPageId !== null &&+ providedPageId &&+ providedPageId !== "" &&+ Number(providedPageId) !== derivedPageId+ ) {+ throw pageIdComponentMismatchError(+ providedPageId,+ String(derivedPageId),+ );+ }++ // Use the derived pageId from components, or parse the provided one+ const pageId =+ derivedPageId ?? (providedPageId ? Number(providedPageId) : null);++ // Create the status report+ const report = await tx+ .insert(statusReport)+ .values({+ workspaceId,+ pageId,+ title: req.title,+ status: protoStatusToDb(req.status),+ })+ .returning()+ .get();++ if (!report) {+ throw statusReportCreateFailedError();+ }++ // Create page component associations+ await updatePageComponentAssociations(+ report.id,+ validatedComponents.componentIds,+ tx,+ );- return { report, newUpdate, pageId };- });+ // Create the initial update+ const newUpdate = await tx+ .insert(statusReportUpdate)+ .values({+ statusReportId: report.id,+ status: protoStatusToDb(req.status),+ date,+ message: req.message,+ })+ .returning()+ .get();++ if (!newUpdate) {+ throw statusReportCreateFailedError();+ }++ return { report, newUpdate, pageId };+ },+ );// Send notifications if requested (outside transaction)if (req.notify) {diff --git a/apps/status-page/src/app/(public)/client.tsx b/apps/status-page/src/app/(public)/client.tsxindex bbbc97aed..a11495dc4 100644--- a/apps/status-page/src/app/(public)/client.tsx+++ b/apps/status-page/src/app/(public)/client.tsx@@ -18,15 +18,6 @@ import {StatusTitle,} from "@/components/status-page/status";import { StatusBanner } from "@/components/status-page/status-banner";-import {- StatusEvent,- StatusEventAffected,- StatusEventAffectedBadge,- StatusEventContent,- StatusEventDate,- StatusEventTimelineReport,- StatusEventTitle,-} from "@/components/status-page/status-events";import { StatusMonitor } from "@/components/status-page/status-monitor";import { ThemePalettePicker } from "@/components/themes/theme-palette-picker";import { ThemeSelect } from "@/components/themes/theme-select";@@ -320,45 +311,3 @@ function ThemePlaygroundStatus({</div>);}--// NOTE: we could add a tabs component here to switch between status and events-function ThemePlaygroundEvents({- className,- ...props-}: React.ComponentProps<"div"> & {}) {- const trpc = useTRPC();- const { data: report } = useQuery(- trpc.statusPage.getNoopReport.queryOptions(),- );- const firstUpdate = report?.statusReportUpdates[0];-- if (!firstUpdate || !report) return null;-- return (- <div className={cn("h-full w-full", className)} {...props}>- <Status variant="success">- <StatusEvent>- <StatusEventDate date={firstUpdate.date} className="lg:flex-row" />- <StatusEventContent hoverable={false}>- <StatusEventTitle className="inline-flex gap-1">- {report.title}- </StatusEventTitle>- {report.statusReportsToPageComponents.length > 0 ? (- <StatusEventAffected>- {report.statusReportsToPageComponents.map((affected) => (- <StatusEventAffectedBadge key={affected.pageComponent.id}>- {affected.pageComponent.name}- </StatusEventAffectedBadge>- ))}- </StatusEventAffected>- ) : null}- <StatusEventTimelineReport- updates={report.statusReportUpdates}- reportId={report.id}- />- </StatusEventContent>- </StatusEvent>- </Status>- </div>- );-}diff --git a/apps/status-page/src/components/status-page/status-events.tsx b/apps/status-page/src/components/status-page/status-events.tsxindex a0ce375bd..5ef261eb0 100644--- a/apps/status-page/src/components/status-page/status-events.tsx+++ b/apps/status-page/src/components/status-page/status-events.tsx@@ -12,8 +12,7 @@ import {} from "@openstatus/ui/components/ui/tooltip";import { cn } from "@openstatus/ui/lib/utils";import { formatDistanceStrict } from "date-fns";-import { Check, ChevronRight } from "lucide-react";-import Link from "next/link";+import { Check } from "lucide-react";import { status } from "./messages";export function StatusEventGroup({@@ -291,37 +290,6 @@ export function StatusEventTimelineReportUpdate({);}-function StatusEventTimelineReadMore({- href,- withDot = true,-}: {- href: string;- withDot?: boolean;-}) {- return (- <div className="group">- <div className="flex flex-row items-center justify-between gap-2">- <div className="flex flex-row gap-4">- {withDot ? (- <div className="flex flex-col">- <div className="flex h-5 flex-col items-center justify-center">- <div className="size-2.5 shrink-0 rounded-full bg-muted" />- </div>- </div>- ) : null}- <Link- href={href}- className="flex items-center gap-1 font-medium text-muted-foreground text-sm hover:text-foreground hover:underline"- >- View full report- <ChevronRight className="size-4" />- </Link>- </div>- </div>- </div>- );-}-export function StatusEventTimelineMaintenance({maintenance,withDot = true,diff --git a/apps/status-page/src/components/status-page/status-updates.tsx b/apps/status-page/src/components/status-page/status-updates.tsxindex fe61ec6de..67b59ab65 100644--- a/apps/status-page/src/components/status-page/status-updates.tsx+++ b/apps/status-page/src/components/status-page/status-updates.tsx@@ -215,28 +215,6 @@ function CopyInputButton({);}-function CopyButton({- value,- onClick,- ...props-}: React.ComponentProps<typeof Button> & {- value: string;-}) {- const { copy, isCopied } = useCopyToClipboard();- return (- <Button- size="sm"- onClick={(e) => {- copy(value, { withToast: true });- onClick?.(e);- }}- {...props}- >- {isCopied ? "Copied" : "Copy"}- </Button>- );-}-function SuccessMessage() {return (<div className="flex flex-col items-center justify-center gap-1 p-3">diff --git a/packages/db/src/utils/api-key.test.ts b/packages/db/src/utils/api-key.test.tsindex 448331a01..f099a299f 100644--- a/packages/db/src/utils/api-key.test.ts+++ b/packages/db/src/utils/api-key.test.ts@@ -9,7 +9,7 @@ import {describe("API Key Utilities", () => {describe("generateApiKey", () => {it("should generate a token with correct format", async () => {- const { token, prefix, hash } = await generateApiKey();+ const { token } = await generateApiKey();// Token should start with "os_" and be 35 chars total (os_ + 32 hex)expect(token).toMatch(/^os_[a-f0-9]{32}$/);diff --git a/packages/notifications/pagerduty/src/index.ts b/packages/notifications/pagerduty/src/index.tsindex f9251e5e7..6b946c2a8 100644--- a/packages/notifications/pagerduty/src/index.ts+++ b/packages/notifications/pagerduty/src/index.ts@@ -91,7 +91,6 @@ export const sendDegraded = async ({export const sendRecovery = async ({monitor,notification,- incident,}: NotificationContext) => {const data = pagerdutyDataSchema.parse(JSON.parse(notification.data));