Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
chore: dashboard incidents improvements (#2822)
Maximilian Kaskea1d5d4c1084c
diff --git a/apps/dashboard/src/app/(dashboard)/incidents/[id]/client.tsx b/apps/dashboard/src/app/(dashboard)/incidents/[id]/client.tsxindex 3aa26f6e1..a9f77fd43 100644--- a/apps/dashboard/src/app/(dashboard)/incidents/[id]/client.tsx+++ b/apps/dashboard/src/app/(dashboard)/incidents/[id]/client.tsx@@ -34,6 +34,7 @@ import {PropertyValue,} from "@/components/content/property-list";import { SectionGroup } from "@/components/content/section";+import { Timeline } from "@/components/content/timeline";import {IncidentActions,hasIncidentActions,@@ -43,7 +44,7 @@ import { IncidentHeading } from "@/components/incidents/incident-heading";import { IncidentPostmortem } from "@/components/incidents/incident-postmortem";import { IncidentProperties } from "@/components/incidents/incident-properties";import { IncidentStatusReport } from "@/components/incidents/incident-status-report";-import { IncidentTimeline } from "@/components/incidents/incident-timeline";+import { IncidentTimelineItem } from "@/components/incidents/incident-timeline";import { ResolveReportDialog } from "@/components/incidents/resolve-report-dialog";import { incidentEndedAt, personName } from "@/data/managed-incidents.client";import { useFeature } from "@/hooks/use-feature";@@ -160,14 +161,18 @@ export function Client({ id }: { id: number }) {</TabsTrigger><TabsTrigger value="postmortem">Postmortem</TabsTrigger></TabsList>- <TabsContent value="timeline" className="flex flex-col gap-8">- {closed ? null : (- <IncidentComposer- incident={incident}- onStatusChanged={onStatusChanged}- />- )}- <IncidentTimeline events={events ?? []} />+ <TabsContent value="timeline">+ <Timeline>+ {closed ? null : (+ <IncidentComposer+ incident={incident}+ onStatusChanged={onStatusChanged}+ />+ )}+ {events?.map((event) => (+ <IncidentTimelineItem key={event.id} event={event} />+ ))}+ </Timeline></TabsContent><TabsContent value="postmortem"><IncidentPostmortemdiff --git a/apps/dashboard/src/components/content/detail.tsx b/apps/dashboard/src/components/content/detail.tsxindex aa74c7fc6..81511a8a5 100644--- a/apps/dashboard/src/components/content/detail.tsx+++ b/apps/dashboard/src/components/content/detail.tsx@@ -299,8 +299,7 @@ export function DetailSectionHeader({const detailSectionTitleVariants = cva("", {variants: {variant: {- label:- "text-muted-foreground text-xs font-medium tracking-wide uppercase",+ label: "text-muted-foreground text-xs font-light tracking-wide uppercase",heading: "text-base font-medium",},},diff --git a/apps/dashboard/src/components/incidents/incident-composer.tsx b/apps/dashboard/src/components/incidents/incident-composer.tsxindex c8994b901..7ee4ccf2f 100644--- a/apps/dashboard/src/components/incidents/incident-composer.tsx+++ b/apps/dashboard/src/components/incidents/incident-composer.tsx@@ -25,6 +25,7 @@ import {ComposerTabs,ComposerTextarea,} from "@/components/content/composer";+import { TimelineItem } from "@/components/content/timeline";import { personName, statusConfig } from "@/data/managed-incidents.client";import { useTRPC } from "@/lib/trpc/client";@@ -33,6 +34,9 @@ import { useInvalidateIncident } from "./use-invalidate-incident";/*** Posting with the status unchanged adds a note; picking a new status moves* the incident and carries the text on the same timeline event.+ *+ * Rendered as the head item of the timeline so the rail runs from the avatar+ * down to the latest event.*/export function IncidentComposer({incident,@@ -88,7 +92,7 @@ export function IncidentComposer({}return (- <div className="flex gap-3">+ <TimelineItem><UserAvatarname={user ? personName(user) : null}src={user?.photoUrl}@@ -153,6 +157,6 @@ export function IncidentComposer({</div></ComposerFooter></Composer>- </div>+ </TimelineItem>);}diff --git a/apps/dashboard/src/components/incidents/incident-properties.tsx b/apps/dashboard/src/components/incidents/incident-properties.tsxindex b08ec7316..d824d763a 100644--- a/apps/dashboard/src/components/incidents/incident-properties.tsx+++ b/apps/dashboard/src/components/incidents/incident-properties.tsx@@ -160,7 +160,10 @@ export function IncidentProperties({{closed ? (commander ? (<>- <UserAvatar name={commander} />+ <UserAvatar+ name={commander}+ src={incident.commander?.photoUrl}+ /><span className="truncate">{commander}</span></>) : (@@ -192,7 +195,7 @@ export function IncidentProperties({value={String(member.user.id)}className="font-mono">- <UserAvatar name={name} />+ <UserAvatar name={name} src={member.user.photoUrl} /><span className="truncate">{name}</span></SelectItem>);diff --git a/apps/dashboard/src/components/incidents/incident-timeline.tsx b/apps/dashboard/src/components/incidents/incident-timeline.tsxindex c1e3c7c1b..921fd739a 100644--- a/apps/dashboard/src/components/incidents/incident-timeline.tsx+++ b/apps/dashboard/src/components/incidents/incident-timeline.tsx@@ -24,11 +24,11 @@ import {Unlinked,Warning,} from "@openstatus/icons";+import { SlackIcon } from "@openstatus/icons/brand";import type { StatusVariant } from "@/components/common/status-dot";import { ProcessMessage } from "@/components/content/process-message";import {- Timeline,TimelineBody,TimelineContent,TimelineHeader,@@ -77,6 +77,8 @@ const eventConfig: Record<const TRANSITION = /^\w+ changed from \w+ to (\w+)(?:\n\n([\s\S]+))?$/;const DECLARED = /^Declared as (\w+): /;+// Slack-mirrored notes end with a permalink line appended by the bot.+const FROM_SLACK = /\n\n\[From Slack\]\((https?:\/\/\S+)\)$/;// Events carry no structured payload, so the target of a transition is read// from the service's own message. An unknown shape falls back to the raw text.@@ -84,10 +86,18 @@ function parseEvent(event: Event): {status?: IncidentStatus;severity?: IncidentSeverity;message: string | null;+ slackUrl?: string;} {const message = event.message;if (!message) return { message: null };+ if (event.type === "note") {+ const match = FROM_SLACK.exec(message);+ if (match) {+ return { message: message.replace(FROM_SLACK, ""), slackUrl: match[1] };+ }+ }+// The message only repeats the label around a raw Slack channel id.if (event.type === "slack_channel_bound" ||@@ -114,46 +124,51 @@ function parseEvent(event: Event): {return { message };}-export function IncidentTimeline({ events }: { events: Event[] }) {- if (events.length === 0) return null;+/** One event as a `TimelineItem`; the page composes the `Timeline` around it. */+export function IncidentTimelineItem({ event }: { event: Event }) {+ const config = eventConfig[event.type];+ const { status, severity, message, slackUrl } = parseEvent(event);+ const variant = status+ ? statusConfig[status].variant+ : event.type === "declared" && severity+ ? severityConfig[severity].variant+ : config.variant;return (- <Timeline>- {events.map((event) => {- const config = eventConfig[event.type];- const { status, severity, message } = parseEvent(event);- const variant = status- ? statusConfig[status].variant- : event.type === "declared" && severity- ? severityConfig[severity].variant- : config.variant;- return (- <TimelineItem key={event.id}>- <TimelineIndicator variant={variant}>- <config.icon />- </TimelineIndicator>- <TimelineContent>- <TimelineHeader>- <TimelineTitle>- {config.label}- {status ? <IncidentStatusBadge status={status} /> : null}- {severity ? (- <IncidentSeverityBadge severity={severity} />- ) : null}- <TimelineMeta>- {personName(event.createdByUser) ?? "System"}- </TimelineMeta>- </TimelineTitle>- <TimelineTime date={event.createdAt} />- </TimelineHeader>- {message ? (- <TimelineBody className="prose prose-sm dark:prose-invert max-w-none">- <ProcessMessage value={message} />- </TimelineBody>- ) : null}- </TimelineContent>- </TimelineItem>- );- })}- </Timeline>+ <TimelineItem>+ <TimelineIndicator variant={variant}>+ <config.icon />+ </TimelineIndicator>+ <TimelineContent>+ <TimelineHeader>+ <TimelineTitle>+ {config.label}+ {status ? <IncidentStatusBadge status={status} /> : null}+ {severity ? <IncidentSeverityBadge severity={severity} /> : null}+ <TimelineMeta>+ {personName(event.createdByUser) ?? "System"}+ </TimelineMeta>+ {slackUrl ? (+ <TimelineMeta>+ <a+ href={slackUrl}+ target="_blank"+ rel="noreferrer"+ className="decoration-muted-foreground/50 hover:text-foreground inline-flex items-center gap-1 underline decoration-dashed underline-offset-2"+ >+ <SlackIcon className="size-3.5" />+ via Slack+ </a>+ </TimelineMeta>+ ) : null}+ </TimelineTitle>+ <TimelineTime date={event.createdAt} />+ </TimelineHeader>+ {message ? (+ <TimelineBody className="prose prose-sm dark:prose-invert max-w-none">+ <ProcessMessage value={message} />+ </TimelineBody>+ ) : null}+ </TimelineContent>+ </TimelineItem>);}diff --git a/packages/services/src/incident/list.ts b/packages/services/src/incident/list.tsindex 48ec4b658..af5a948c6 100644--- a/packages/services/src/incident/list.ts+++ b/packages/services/src/incident/list.ts@@ -12,6 +12,7 @@ const userColumns = {firstName: true,lastName: true,email: true,+ photoUrl: true,} as const;const statusOrder = sql`case ${incident.status} when 'open' then 0 when 'mitigated' then 1 when 'resolved' then 2 else 3 end`;