From ef3e8278d20eb26daacc96b7db333f15d7e5cabe Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Tue, 7 Jul 2026 00:26:38 +0000 Subject: [PATCH] feat(uptime): prefill add-monitor form from project (domain, url, owner email) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the common case of monitoring the project's own site, prefill the label with the project domain, the target with the project URL, and the alert email with the signed-in owner's email — so adding an HTTP monitor is one click. Co-Authored-By: Claude Opus 4.8 --- .../projects/[id]/uptime/add-monitor-form.tsx | 15 +++++++++++++- app/(app)/projects/[id]/uptime/page.tsx | 20 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/(app)/projects/[id]/uptime/add-monitor-form.tsx b/app/(app)/projects/[id]/uptime/add-monitor-form.tsx index 3afb1c5a..bbacce9c 100644 --- a/app/(app)/projects/[id]/uptime/add-monitor-form.tsx +++ b/app/(app)/projects/[id]/uptime/add-monitor-form.tsx @@ -13,7 +13,17 @@ const TYPE_HINT: Record = { tcp: "host:port — up when the port accepts a connection.", }; -export function AddMonitorForm({ projectId }: { projectId: string }) { +export function AddMonitorForm({ + projectId, + defaultName = "", + defaultTarget = "", + defaultEmail = "", +}: { + projectId: string; + defaultName?: string; + defaultTarget?: string; + defaultEmail?: string; +}) { const router = useRouter(); const [open, setOpen] = useState(false); const [type, setType] = useState("http"); @@ -78,6 +88,7 @@ export function AddMonitorForm({ projectId }: { projectId: string }) { @@ -89,6 +100,7 @@ export function AddMonitorForm({ projectId }: { projectId: string }) { @@ -134,6 +146,7 @@ export function AddMonitorForm({ projectId }: { projectId: string }) { diff --git a/app/(app)/projects/[id]/uptime/page.tsx b/app/(app)/projects/[id]/uptime/page.tsx index 2e293d53..38fce4c3 100644 --- a/app/(app)/projects/[id]/uptime/page.tsx +++ b/app/(app)/projects/[id]/uptime/page.tsx @@ -59,11 +59,22 @@ export default async function ProjectUptimePage({ const { data: project } = await supabase .from("projects") - .select("id") + .select("id, url") .eq("id", id) .maybeSingle(); if (!project) notFound(); + // Prefill the add-monitor form with what we already know about the project. + const { + data: { user }, + } = await supabase.auth.getUser(); + let domain = project.url as string; + try { + domain = new URL(project.url).host; + } catch { + /* keep raw url as the label */ + } + const { data: monitorsData } = await supabase .from("monitors") .select( @@ -92,7 +103,12 @@ export default async function ProjectUptimePage({ down — and again when it recovers. HTTP, keyword, SSL-expiry, and TCP.

- + {/* Monitors */}