Skip to content

Open-source status page, incident response and uptime monitoring

feat(dashboard): empty states for data tables and charts (#2973)

Maximilian Kaskeddb362fcac80
diff --git a/DESIGN.md b/DESIGN.md
index 1a4da6e52..9dc99f6d8 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -108,8 +108,19 @@ primitive (`docs/adr/0003`).
- **Spacing.** Lists `gap-4`, cards `px-4`, inside a row `gap-2.5`, stacked
compact rows pull up with a short rail. Pages cap at `max-w-6xl`. Padding
is symmetric unless the asymmetry is explained in a comment.
-- **Empty states** use the dashed `EmptyStateContainer` with a title and one
- sentence that says what to do next. Never a bare "No data".
+- **Empty states** share one anatomy from the `EmptyState*` parts: icon
+ (`EmptyStateMedia`), what belongs here (title), why it is empty (one
+ sentence), then optionally one primary action and one escape hatch
+ (`EmptyStateActions`). The wrapper picks the slot: `EmptyStateContainer`
+ for a section, its `inline` prop for a single row inside a table or card,
+ `DataTableEmpty` ghost rows for a table body on first run (via `DataTable
+ emptyState`), `ChartEmpty` at the chart's own height so a resolving fetch
+ never shifts the page. A filter that matches nothing is the table's own
+ "No matches" row with a clear action. A short slot drops the sentence,
+ never the icon. A table without its own `emptyState` falls back to a
+ generic icon and sentence; a primary list always passes its own. Never a
+ bare "No data", and never `100%`, `0 ms` or `N/A` for data that does not
+ exist: use an em dash.
- **Inline editing.** Title and summary are borderless inputs that show their
edge on hover and focus. Save on blur or explicit action; never on every
keystroke.
diff --git a/apps/dashboard/src/app/(dashboard)/incidents/client.tsx b/apps/dashboard/src/app/(dashboard)/incidents/client.tsx
index b0bf111b2..d83aab386 100644
--- a/apps/dashboard/src/app/(dashboard)/incidents/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/incidents/client.tsx
@@ -1,10 +1,14 @@
"use client";
+import { Incident } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useQuery } from "@tanstack/react-query";
+import Link from "next/link";
import {
- EmptyStateContainer,
+ EmptyStateActions,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -15,7 +19,9 @@ import {
SectionTitle,
} from "@/components/content/section";
import { columns } from "@/components/data-table/managed-incidents/columns";
+import { DeclareIncidentButton } from "@/components/incidents/declare-incident-button";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -32,20 +38,32 @@ export function Client() {
Declare and track the incidents your team is responding to.
</SectionDescription>
</SectionHeader>
- {!incidents ? null : incidents.length === 0 ? (
- <EmptyStateContainer>
- <EmptyStateTitle>No incidents declared</EmptyStateTitle>
- <EmptyStateDescription>
- Declared incidents keep the timeline your team builds while
- responding. Nothing here is public: use a status report to tell
- your users.
- </EmptyStateDescription>
- </EmptyStateContainer>
- ) : (
+ {!incidents ? null : (
<DataTable
columns={columns}
data={incidents}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Incident />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No incidents declared</EmptyStateTitle>
+ <EmptyStateDescription>
+ A declared incident keeps the timeline your team builds while
+ responding. Nothing here is public: a status report is what
+ tells your users.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <DeclareIncidentButton>
+ <Button size="sm">Declare incident</Button>
+ </DeclareIncidentButton>
+ <Button size="sm" variant="outline" asChild>
+ <Link href="/status-pages">Pick a status page</Link>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
)}
</Section>
diff --git a/apps/dashboard/src/app/(dashboard)/invite/client.tsx b/apps/dashboard/src/app/(dashboard)/invite/client.tsx
index afe6711ad..6cf92a14a 100644
--- a/apps/dashboard/src/app/(dashboard)/invite/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/invite/client.tsx
@@ -63,7 +63,7 @@ export function Client() {
This invitation can&apos;t be opened.
</SectionDescription>
</SectionHeader>
- <EmptyStateContainer className="py-8">
+ <EmptyStateContainer>
<EmptyStateTitle>Invitation unavailable</EmptyStateTitle>
<EmptyStateDescription className="font-mono">
{error.message}
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/(list)/client.tsx b/apps/dashboard/src/app/(dashboard)/monitors/(list)/client.tsx
index 969521ed9..c486a0ad6 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/(list)/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/monitors/(list)/client.tsx
@@ -1,12 +1,20 @@
"use client";
import type { RouterInputs } from "@openstatus/api";
-import { ArrowDown, Success, ListFilter } from "@openstatus/icons";
+import { ArrowDown, Success, ListFilter, Monitor } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useQueries, useQuery } from "@tanstack/react-query";
import type { ColumnFiltersState, SortingState } from "@tanstack/react-table";
+import NextLink from "next/link";
import { useQueryStates } from "nuqs";
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
Section,
SectionDescription,
@@ -26,11 +34,12 @@ import {
MetricCardValue,
} from "@/components/metric/metric-card";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { getMonitorListMetrics } from "@/data/metrics.client";
import { useTRPC } from "@/lib/trpc/client";
-import { searchParamsParsers } from "./search-params";
+import { type MonitorStatus, searchParamsParsers } from "./search-params";
type MetricType = NonNullable<
RouterInputs["tinybird"]["globalMetrics"]["type"]
@@ -64,6 +73,9 @@ export function Client() {
const [searchParams, setSearchParams] = useQueryStates(searchParamsParsers);
const [sorting, setSorting] = useState<SortingState>([]);
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
+ // latest values for updater chains within one tick (the render closure lags)
+ const sortingRef = useRef(sorting);
+ const columnFiltersRef = useRef(columnFilters);
const metricQueries = useQueries({
queries: METRIC_TYPES.map((type) => {
@@ -82,11 +94,13 @@ export function Client() {
// TODO: ideally we read from the searchParamsCache and there is no layout shift
useEffect(() => {
- if (searchParams.status) {
- setColumnFilters([{ id: "status", value: [searchParams.status] }]);
+ if (searchParams.status?.length) {
+ columnFiltersRef.current = [{ id: "status", value: searchParams.status }];
+ setColumnFilters(columnFiltersRef.current);
}
if (searchParams.sort) {
- setSorting([searchParams.sort]);
+ sortingRef.current = [searchParams.sort];
+ setSorting(sortingRef.current);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
@@ -95,6 +109,32 @@ export function Client() {
const metrics = getMonitorListMetrics(monitors, globalMetrics);
+ // every filter or sort change goes through here, from the table or the cards,
+ // so the URL mirrors the state
+ const onColumnFiltersChange: React.Dispatch<
+ React.SetStateAction<ColumnFiltersState>
+ > = (updater) => {
+ const next =
+ typeof updater === "function"
+ ? updater(columnFiltersRef.current)
+ : updater;
+ columnFiltersRef.current = next;
+ setColumnFilters(next);
+ const status = next.find((f) => f.id === "status")?.value as
+ | MonitorStatus[]
+ | undefined;
+ setSearchParams({ status: status?.length ? status : null });
+ };
+ const onSortingChange: React.Dispatch<React.SetStateAction<SortingState>> = (
+ updater,
+ ) => {
+ const next =
+ typeof updater === "function" ? updater(sortingRef.current) : updater;
+ sortingRef.current = next;
+ setSorting(next);
+ setSearchParams({ sort: next[0] ?? null });
+ };
+
return (
<SectionGroup>
<Section>
@@ -126,21 +166,17 @@ export function Client() {
variant={metric.variant}
onClick={() => {
if (metric.key === "p95") {
- if (sorting.length === 0 || !isActive) {
- setSearchParams({ sort: { id: "p95", desc: true } });
- setSorting([{ id: "p95", desc: true }]);
- } else {
- setSearchParams({ sort: null });
- setSorting([]);
- }
+ onSortingChange(
+ sorting.length === 0 || !isActive
+ ? [{ id: "p95", desc: true }]
+ : [],
+ );
} else {
- if (columnFilters.length === 0 || !isActive) {
- setSearchParams({ status: metric.key });
- setColumnFilters([{ id: "status", value: [metric.key] }]);
- } else {
- setSearchParams({ status: null });
- setColumnFilters([]);
- }
+ onColumnFiltersChange(
+ columnFilters.length === 0 || !isActive
+ ? [{ id: "status", value: [metric.key] }]
+ : [],
+ );
}
}}
>
@@ -176,10 +212,30 @@ export function Client() {
<MonitorDataTableToolbar {...props} tags={tags ?? []} />
)}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Monitor />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No monitors yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ A monitor checks an endpoint on a schedule from the regions you
+ pick and alerts you when it degrades or fails.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" asChild>
+ <NextLink href="/monitors/create">Create monitor</NextLink>
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink href="/agents/cli">Import via CLI</NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
columnFilters={columnFilters}
- setColumnFilters={setColumnFilters}
+ setColumnFilters={onColumnFiltersChange}
sorting={sorting}
- setSorting={setSorting}
+ setSorting={onSortingChange}
defaultColumnVisibility={{
active: false,
url: false,
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/(list)/search-params.ts b/apps/dashboard/src/app/(dashboard)/monitors/(list)/search-params.ts
index 4843b0ddf..9814a9f80 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/(list)/search-params.ts
+++ b/apps/dashboard/src/app/(dashboard)/monitors/(list)/search-params.ts
@@ -1,6 +1,7 @@
import {
createParser,
createSearchParamsCache,
+ parseAsArrayOf,
parseAsStringEnum,
} from "nuqs/server";
@@ -15,8 +16,16 @@ export const parseAsSort = createParser({
},
});
+export const MONITOR_STATUSES = [
+ "active",
+ "degraded",
+ "error",
+ "inactive",
+] as const;
+export type MonitorStatus = (typeof MONITOR_STATUSES)[number];
+
export const searchParamsParsers = {
- status: parseAsStringEnum(["active", "degraded", "error", "inactive"]),
+ status: parseAsArrayOf(parseAsStringEnum([...MONITOR_STATUSES])),
sort: parseAsSort,
};
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
index 86020fb57..d6e57751f 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/incidents/page.tsx
@@ -1,14 +1,14 @@
"use client";
-import { Info } from "@openstatus/icons";
+import { Info, Success } from "@openstatus/icons";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
import { Link } from "@/components/common/link";
import { Note } from "@/components/common/note";
import {
- EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -20,6 +20,7 @@ import {
} from "@/components/content/section";
import { columns } from "@/components/data-table/incidents/columns";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -60,20 +61,23 @@ export default function Page() {
)}
</SectionDescription>
</SectionHeader>
- {monitorIncidents.length === 0 ? (
- <EmptyStateContainer>
- <EmptyStateTitle>No downtime</EmptyStateTitle>
- <EmptyStateDescription>
- No downtime recorded for this monitor.
- </EmptyStateDescription>
- </EmptyStateContainer>
- ) : (
- <DataTable
- columns={columns}
- data={monitorIncidents}
- paginationComponent={DataTablePaginationSimple}
- />
- )}
+ <DataTable
+ columns={columns}
+ data={monitorIncidents}
+ paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia variant="success">
+ <Success />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No downtime recorded</EmptyStateTitle>
+ <EmptyStateDescription>
+ A failed check opens a downtime entry here and alerts the
+ channels linked to this monitor. Nothing has failed so far.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
+ />
</Section>
</SectionGroup>
);
diff --git a/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/client.tsx b/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/client.tsx
index 4fe52c33a..e058cf554 100644
--- a/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/monitors/[id]/overview/client.tsx
@@ -1,7 +1,10 @@
"use client";
-import { useQuery } from "@tanstack/react-query";
+import { Pause, Play, Trend } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { endOfDay } from "date-fns";
+import NextLink from "next/link";
import { useParams } from "next/navigation";
import { useQueryStates } from "nuqs";
import React, { useEffect } from "react";
@@ -10,9 +13,12 @@ import { toast } from "sonner";
import { ChartAreaLatency } from "@/components/chart/chart-area-latency";
import { ChartAreaTimingPhases } from "@/components/chart/chart-area-timing-phases";
import { ChartBarUptime } from "@/components/chart/chart-bar-uptime";
+import { ChartEmpty } from "@/components/chart/chart-empty";
import {
+ EmptyStateActions,
EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -38,6 +44,7 @@ import { PopoverQuantile } from "@/components/popovers/popover-quantile";
import { PopoverResolution } from "@/components/popovers/popover-resolution";
import {
FREE_MAX_PERIOD,
+ hasMetricsData,
isPaidPeriod,
mapRegionMetrics,
} from "@/data/metrics.client";
@@ -58,6 +65,15 @@ export function Client() {
trpc.monitor.get.queryOptions({ id: Number.parseInt(id) }),
);
const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());
+ const queryClient = useQueryClient();
+ const resumeMonitor = useMutation(
+ trpc.monitor.updateMonitors.mutationOptions({
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: trpc.monitor.pathKey() });
+ },
+ onError: () => toast.error("Failed to resume the monitor"),
+ }),
+ );
const isBlockedPeriod = workspace?.plan === "free" && isPaidPeriod(period);
// snap free workspaces back synchronously so charts never fire (and the server
@@ -101,24 +117,55 @@ export function Client() {
const { data: regionTimeline, isError: isRegionTimelineError } =
useQuery(regionTimelineQuery);
+ const { data: metrics, isLoading: isMetricsLoading } = useQuery({
+ ...trpc.tinybird.metrics.queryOptions({
+ monitorId: id,
+ period: effectivePeriod,
+ type: (monitor?.jobType ?? "http") as
+ | "http"
+ | "tcp"
+ | "dns"
+ | "icmp"
+ | "grpc",
+ regions: selectedRegions,
+ }),
+ enabled: !!monitor,
+ });
+ const noData = !!metrics && !hasMetricsData(metrics);
+ // a paused monitor keeps its history; the paused card only fills an empty slot
+ const paused = monitor?.active === false && noData;
// free plans ignore the region filter server-side, so they keep every row
const filtersRegions =
workspace?.plan !== "free" && !!selectedRegions?.length;
+ const filteredOut = noData && filtersRegions;
+ const maxPeriod = workspace?.plan === "free" ? FREE_MAX_PERIOD : "90d";
- const regionMetrics: RegionMetric[] = React.useMemo(() => {
- const configured = [
+ const configuredRegions = React.useMemo(
+ () => [
...(monitor?.regions ?? []),
...(monitor?.privateLocations?.map((location) =>
location.id.toString(),
) ?? []),
- ];
- return mapRegionMetrics(
- regionTimeline,
- filtersRegions
- ? configured.filter((region) => selectedRegions?.includes(region))
- : configured,
- );
- }, [regionTimeline, monitor, filtersRegions, selectedRegions]);
+ ],
+ [monitor],
+ );
+ const regionMetrics: RegionMetric[] = React.useMemo(
+ () =>
+ mapRegionMetrics(
+ regionTimeline,
+ filtersRegions
+ ? configuredRegions.filter((region) =>
+ selectedRegions?.includes(region),
+ )
+ : configuredRegions,
+ ),
+ [regionTimeline, configuredRegions, filtersRegions, selectedRegions],
+ );
+ // e.g. a stale region in the URL after the monitor's regions were edited
+ const regionsFilteredOut =
+ filtersRegions &&
+ configuredRegions.length > 0 &&
+ regionMetrics.length === 0;
if (!monitor) return null;
@@ -151,12 +198,7 @@ export function Client() {
privateLocations={monitor.privateLocations}
/>
</div>
- <GlobalUptimeSection
- monitorId={id}
- jobType={monitor.jobType as "http" | "tcp" | "dns" | "icmp" | "grpc"}
- period={effectivePeriod}
- regions={selectedRegions}
- />
+ <GlobalUptimeSection metrics={metrics} isLoading={isMetricsLoading} />
</Section>
<Section>
<SectionHeader>
@@ -165,12 +207,59 @@ export function Client() {
Uptime across all the selected regions
</SectionDescription>
</SectionHeader>
- <ChartBarUptime
- monitorId={id}
- type={monitor.jobType as "http" | "tcp" | "dns" | "icmp" | "grpc"}
- period={effectivePeriod}
- regions={selectedRegions}
- />
+ {/* the slot keeps the chart's height so the tinybird fetch never shifts the page */}
+ {paused ? (
+ <ChartEmpty className="h-[130px]">
+ <EmptyStateMedia>
+ <Pause />
+ </EmptyStateMedia>
+ <EmptyStateTitle>This monitor is paused</EmptyStateTitle>
+ <EmptyStateActions>
+ <Button
+ size="sm"
+ disabled={resumeMonitor.isPending}
+ onClick={() =>
+ resumeMonitor.mutate({ ids: [monitor.id], active: true })
+ }
+ >
+ <Play />
+ Resume monitor
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink href={`/monitors/${id}/edit`}>Edit monitor</NextLink>
+ </Button>
+ </EmptyStateActions>
+ </ChartEmpty>
+ ) : noData ? (
+ <ChartEmpty className="h-[130px]">
+ <EmptyStateMedia>
+ <Trend />
+ </EmptyStateMedia>
+ <EmptyStateTitle>
+ {filteredOut
+ ? "No checks from the selected regions"
+ : "No checks in this period"}
+ </EmptyStateTitle>
+ {filteredOut ? (
+ <EmptyStateActions>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => setSearchParams({ regions: null })}
+ >
+ Show all regions
+ </Button>
+ </EmptyStateActions>
+ ) : null}
+ </ChartEmpty>
+ ) : (
+ <ChartBarUptime
+ monitorId={id}
+ type={monitor.jobType as "http" | "tcp" | "dns" | "icmp" | "grpc"}
+ period={effectivePeriod}
+ regions={selectedRegions}
+ />
+ )}
</Section>
<Section>
{/* TODO: based on http, we have Timing Phases instead of Latency */}
@@ -185,7 +274,25 @@ export function Client() {
within a <DropdownInterval />{" "}
<PopoverResolution>resolution</PopoverResolution>
</div>
- {monitor.jobType === "http" ? (
+ {noData ? (
+ <ChartEmpty>
+ <EmptyStateMedia>{paused ? <Pause /> : <Trend />}</EmptyStateMedia>
+ <EmptyStateTitle>
+ {paused
+ ? "No latency while paused"
+ : filteredOut
+ ? "No latency from the selected regions"
+ : "No latency in this period"}
+ </EmptyStateTitle>
+ <EmptyStateDescription>
+ {paused
+ ? "Resume the monitor and response times fill in from the first check."
+ : filteredOut
+ ? "Pick a region that has reported in this period."
+ : "The first check lands within a minute of activation."}
+ </EmptyStateDescription>
+ </ChartEmpty>
+ ) : monitor.jobType === "http" ? (
<ChartAreaTimingPhases
monitorId={id}
degradedAfter={monitor.degradedAfter}
@@ -232,6 +339,8 @@ export function Client() {
privateLocations={monitor.privateLocations ?? []}
loading={!regionTimeline}
degradedAfter={monitor.degradedAfter}
+ filteredOut={regionsFilteredOut}
+ onShowAll={() => setSearchParams({ regions: null })}
/>
)}
</Section>
diff --git a/apps/dashboard/src/app/(dashboard)/notifications/client.tsx b/apps/dashboard/src/app/(dashboard)/notifications/client.tsx
index e1a7e112a..0a6f94b92 100644
--- a/apps/dashboard/src/app/(dashboard)/notifications/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/notifications/client.tsx
@@ -1,6 +1,9 @@
"use client";
+import { ExternalLink, Notification } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useMutation, useQuery } from "@tanstack/react-query";
+import NextLink from "next/link";
import { useQueryStates } from "nuqs";
import { Link } from "@/components/common/link";
@@ -12,7 +15,9 @@ import {
} from "@/components/content/action-card";
import { ActionCardGroup } from "@/components/content/action-card";
import {
- EmptyStateContainer,
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -25,6 +30,7 @@ import {
import { columns } from "@/components/data-table/notifications/columns";
import { FormSheetNotifier } from "@/components/forms/notifications/sheet";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { config, hiddenProviders } from "@/data/notifications.client";
import { useTRPC } from "@/lib/trpc/client";
@@ -65,25 +71,46 @@ export function Client() {
</SectionDescription>
</SectionHeader>
<Section>
- {notifications.length === 0 ? (
- <EmptyStateContainer>
- <EmptyStateTitle>No notifier found</EmptyStateTitle>
- </EmptyStateContainer>
- ) : (
- <DataTable
- paginationComponent={DataTablePaginationSimple}
- columns={columns}
- data={notifications}
- />
- )}
+ <DataTable
+ paginationComponent={DataTablePaginationSimple}
+ columns={columns}
+ data={notifications}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Notification />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No notification channels yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ A channel receives an alert when a monitor fails or recovers.
+ Connect one below and attach it to your monitors.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" asChild>
+ <a href="#notifier-channels">Choose a channel</a>
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink
+ href="https://www.openstatus.dev/docs/reference/notification"
+ target="_blank"
+ rel="noreferrer"
+ >
+ <ExternalLink />
+ Read the docs
+ </NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
+ />
</Section>
- <Section>
+ <Section id="notifier-channels" className="scroll-mt-20">
<SectionHeader>
<SectionTitle>Create a new notifier</SectionTitle>
<SectionDescription>
Define your notifications to receive alerts when downtime occurs.{" "}
<Link
- href="https://www.openstatus.dev/docs/reference/notification/"
+ href="https://www.openstatus.dev/docs/reference/notification"
rel="noreferrer"
target="_blank"
>
diff --git a/apps/dashboard/src/app/(dashboard)/overview/page.tsx b/apps/dashboard/src/app/(dashboard)/overview/page.tsx
index 8ccf285c4..1866f102b 100644
--- a/apps/dashboard/src/app/(dashboard)/overview/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/overview/page.tsx
@@ -1,13 +1,14 @@
"use client";
-import { Agent } from "@openstatus/icons";
+import { Agent, Clock, Success } from "@openstatus/icons";
import { useQuery } from "@tanstack/react-query";
import Link from "next/link";
import { NoteButton } from "@/components/common/note";
import { NoteDismissible } from "@/components/common/note-dismissible";
import {
- EmptyStateContainer,
+ EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -28,6 +29,7 @@ import {
MetricCardValue,
} from "@/components/metric/metric-card";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { buildOverviewData } from "@/data/overview-events.client";
import { useTRPC } from "@/lib/trpc/client";
@@ -133,21 +135,26 @@ export default function Page() {
Everything currently unresolved, newest first.
</SectionDescription>
</SectionHeader>
- {needsAttention.length > 0 ? (
- <DataTable
- paginationComponent={DataTablePaginationSimple}
- columns={columns}
- data={needsAttention}
- defaultSorting={[{ id: "startedAt", desc: true }]}
- defaultColumnVisibility={{ duration: false, endsAt: false }}
- />
- ) : (
- <EmptyStateContainer>
- <EmptyStateTitle>
- All clear - nothing needs your attention
- </EmptyStateTitle>
- </EmptyStateContainer>
- )}
+ <DataTable
+ paginationComponent={DataTablePaginationSimple}
+ columns={columns}
+ data={needsAttention}
+ defaultSorting={[{ id: "startedAt", desc: true }]}
+ defaultColumnVisibility={{ duration: false, endsAt: false }}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia variant="success">
+ <Success />
+ </EmptyStateMedia>
+ <EmptyStateTitle>All clear</EmptyStateTitle>
+ <EmptyStateDescription>
+ {openIncidents
+ ? "Nothing is unresolved. Failing monitors, open incidents and status reports show up here."
+ : "Incidents could not be loaded. Failing monitors and open status reports still show up here."}
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
+ />
</Section>
{upcomingMaintenances.length > 0 ? (
<Section>
@@ -174,19 +181,26 @@ export default function Page() {
last 7 days.
</SectionDescription>
</SectionHeader>
- {recentlyResolved.length > 0 ? (
- <DataTable
- paginationComponent={DataTablePaginationSimple}
- columns={columns}
- data={recentlyResolved}
- defaultSorting={[{ id: "startedAt", desc: true }]}
- defaultColumnVisibility={{ action: false, endsAt: false }}
- />
- ) : (
- <EmptyStateContainer>
- <EmptyStateTitle>No recent activity</EmptyStateTitle>
- </EmptyStateContainer>
- )}
+ <DataTable
+ paginationComponent={DataTablePaginationSimple}
+ columns={columns}
+ data={recentlyResolved}
+ defaultSorting={[{ id: "startedAt", desc: true }]}
+ defaultColumnVisibility={{ action: false, endsAt: false }}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Clock />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No recent activity</EmptyStateTitle>
+ <EmptyStateDescription>
+ {endedIncidents
+ ? "Resolved incidents and reports and completed maintenances from the last 7 days land here."
+ : "Incidents could not be loaded. Resolved reports and completed maintenances from the last 7 days still show up here."}
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
+ />
</Section>
</SectionGroup>
);
diff --git a/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx
index cdb5ab7c3..958c18b5a 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/audit-logs/client.tsx
@@ -1,7 +1,7 @@
"use client";
import type { RouterOutputs } from "@openstatus/api";
-import { Lock } from "@openstatus/icons";
+import { AuditLog, Lock } from "@openstatus/icons";
import { useQuery } from "@tanstack/react-query";
import { useState } from "react";
@@ -13,8 +13,8 @@ import {
BillingOverlayDescription,
} from "@/components/content/billing-overlay";
import {
- EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -29,6 +29,7 @@ import { DataTableRowDetails } from "@/components/data-table/audit-logs-workspac
import { AuditLogsDataTableToolbar } from "@/components/data-table/audit-logs-workspace/data-table-toolbar";
import { UpgradeDialog } from "@/components/dialogs/upgrade";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -99,12 +100,19 @@ export function Client() {
const trpc = useTRPC();
const [openDialog, setOpenDialog] = useState(false);
const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());
- const { data: auditLogs } = useQuery(trpc.auditLog.list.queryOptions({}));
+ const {
+ data: auditLogs,
+ isPending: auditLogsPending,
+ isError: auditLogsError,
+ } = useQuery(trpc.auditLog.list.queryOptions({}));
if (!workspace) return null;
const isLimited = workspace.limits["audit-log"] === false;
+ // a failed list still renders the page with an empty table (see below)
+ if (!isLimited && auditLogsPending) return null;
+
return (
<SectionGroup>
<SectionHeader>
@@ -157,10 +165,10 @@ export function Client() {
limit="audit-log"
/>
</BillingOverlayContainer>
- ) : auditLogs?.items.length ? (
+ ) : (
<DataTable
columns={columns}
- data={auditLogs.items}
+ data={auditLogs?.items ?? []}
defaultColumnVisibility={{
actorType: false,
entityType: false,
@@ -173,14 +181,32 @@ export function Client() {
<DataTableRowDetails row={row.original} />
)}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <AuditLog />
+ </EmptyStateMedia>
+ {auditLogsError ? (
+ <>
+ <EmptyStateTitle>
+ Audit logs could not be loaded
+ </EmptyStateTitle>
+ <EmptyStateDescription>
+ Try again in a moment.
+ </EmptyStateDescription>
+ </>
+ ) : (
+ <>
+ <EmptyStateTitle>No audit logs yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ Every create, update and delete in this workspace is
+ recorded here with who did it and when.
+ </EmptyStateDescription>
+ </>
+ )}
+ </DataTableEmpty>
+ }
/>
- ) : (
- <EmptyStateContainer>
- <EmptyStateTitle>No audit logs</EmptyStateTitle>
- <EmptyStateDescription>
- Actions taken in this workspace will appear here.
- </EmptyStateDescription>
- </EmptyStateContainer>
)}
</Section>
</SectionGroup>
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx
index fa8df6777..6a35264cf 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/connected-apps-card.tsx
@@ -1,11 +1,15 @@
"use client";
+import { ExternalLink, Plug } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useQuery } from "@tanstack/react-query";
+import NextLink from "next/link";
import { Link } from "@/components/common/link";
import {
- EmptyStateContainer,
+ EmptyStateActions,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import { columns } from "@/components/data-table/settings/connected-apps/columns";
@@ -19,6 +23,7 @@ import {
FormCardTitle,
} from "@/components/forms/form-card";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -46,19 +51,35 @@ export function ConnectedAppsCard() {
<p className="text-destructive text-sm">
Could not load connected apps. Reload the page to try again.
</p>
- ) : grants.length === 0 ? (
- <EmptyStateContainer>
- <EmptyStateTitle>No connected apps</EmptyStateTitle>
- <EmptyStateDescription>
- Add the openstatus MCP server to Claude, Cursor or ChatGPT and
- approve the connection here.
- </EmptyStateDescription>
- </EmptyStateContainer>
) : (
<DataTable
columns={columns}
data={grants}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Plug />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No connected apps yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ Add the openstatus MCP server to Claude, Cursor or ChatGPT and
+ approve the connection here.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink
+ href="https://docs.openstatus.dev/reference/mcp-server"
+ target="_blank"
+ rel="noreferrer"
+ >
+ <ExternalLink />
+ MCP server docs
+ </NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
)}
</FormCardContent>
diff --git a/apps/dashboard/src/app/(dashboard)/settings/integrations/slack/link/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/integrations/slack/link/client.tsx
index 7cbcaf5ca..5982accdd 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/integrations/slack/link/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/integrations/slack/link/client.tsx
@@ -32,7 +32,7 @@ function Message({
children?: React.ReactNode;
}) {
return (
- <EmptyStateContainer className="py-8">
+ <EmptyStateContainer>
<EmptyStateTitle>{title}</EmptyStateTitle>
<EmptyStateDescription>{description}</EmptyStateDescription>
<div className="mt-2 flex gap-2">
diff --git a/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx
index 3e7c26319..a45d52bd1 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/private-locations/client.tsx
@@ -1,7 +1,9 @@
"use client";
import type { RouterOutputs } from "@openstatus/api";
-import { Lock } from "@openstatus/icons";
+import { ExternalLink, Globe, Lock } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useQuery } from "@tanstack/react-query";
+import NextLink from "next/link";
import { useState } from "react";
import { Link } from "@/components/common/link";
@@ -11,6 +13,12 @@ import {
BillingOverlayContainer,
BillingOverlayDescription,
} from "@/components/content/billing-overlay";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
Section,
SectionDescription,
@@ -20,7 +28,9 @@ import {
} from "@/components/content/section";
import { columns } from "@/components/data-table/private-locations/columns";
import { UpgradeDialog } from "@/components/dialogs/upgrade";
+import { FormSheetPrivateLocationCreate } from "@/components/forms/private-location/sheet-create";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -60,6 +70,7 @@ export function Client() {
const { data: privateLocations } = useQuery(
trpc.privateLocation.list.queryOptions(),
);
+ const { data: monitors } = useQuery(trpc.monitor.list.queryOptions());
if (!privateLocations || !workspace) return null;
@@ -111,6 +122,34 @@ export function Client() {
paginationComponent={DataTablePaginationSimple}
columns={columns}
data={privateLocations}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Globe />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No private locations</EmptyStateTitle>
+ <EmptyStateDescription>
+ Run the checker inside your own network to monitor services
+ the public internet cannot reach. Create one, then start the
+ checker with its token.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <FormSheetPrivateLocationCreate monitors={monitors ?? []}>
+ <Button size="sm">Create private location</Button>
+ </FormSheetPrivateLocationCreate>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink
+ href="https://www.openstatus.dev/docs/guides/how-to-create-private-location/"
+ target="_blank"
+ rel="noreferrer"
+ >
+ <ExternalLink />
+ Read the setup guide
+ </NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
)}
</Section>
diff --git a/apps/dashboard/src/app/(dashboard)/settings/private-locations/nav-actions.tsx b/apps/dashboard/src/app/(dashboard)/settings/private-locations/nav-actions.tsx
index 015cec18a..07ba80c1d 100644
--- a/apps/dashboard/src/app/(dashboard)/settings/private-locations/nav-actions.tsx
+++ b/apps/dashboard/src/app/(dashboard)/settings/private-locations/nav-actions.tsx
@@ -1,29 +1,19 @@
"use client";
import { Button } from "@openstatus/ui/components/ui/button";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useQuery } from "@tanstack/react-query";
import { useState } from "react";
import { UpgradeDialog } from "@/components/dialogs/upgrade";
-import { FormSheetPrivateLocation } from "@/components/forms/private-location/sheet";
+import { FormSheetPrivateLocationCreate } from "@/components/forms/private-location/sheet-create";
import { NavFeedback } from "@/components/nav/nav-feedback";
import { useTRPC } from "@/lib/trpc/client";
export function NavActions() {
const trpc = useTRPC();
- const queryClient = useQueryClient();
const [openDialog, setOpenDialog] = useState(false);
const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());
const { data: monitors } = useQuery(trpc.monitor.list.queryOptions());
- const createPrivateLocationMutation = useMutation(
- trpc.privateLocation.new.mutationOptions({
- onSuccess: () => {
- queryClient.invalidateQueries({
- queryKey: trpc.privateLocation.list.queryKey(),
- });
- },
- }),
- );
if (!workspace || !monitors) return null;
@@ -44,21 +34,9 @@ export function NavActions() {
Create Private Location
</Button>
) : (
- <FormSheetPrivateLocation
- monitors={monitors}
- onSubmit={async (values) => {
- await createPrivateLocationMutation.mutateAsync({
- name: values.name,
- monitors: values.monitors,
- token: values.token,
- metadata: Object.fromEntries(
- values.metadata.map((m) => [m.key, m.value]),
- ),
- });
- }}
- >
+ <FormSheetPrivateLocationCreate monitors={monitors}>
<Button size="sm">Create Private Location</Button>
- </FormSheetPrivateLocation>
+ </FormSheetPrivateLocationCreate>
)}
<UpgradeDialog
open={openDialog}
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx
index c44665ace..c263046e8 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/(list)/client.tsx
@@ -1,11 +1,18 @@
"use client";
-import { Theme } from "@openstatus/icons";
+import { ExternalLink, StatusPage, Theme } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { useQuery } from "@tanstack/react-query";
import Link from "next/link";
import { NoteButton } from "@/components/common/note";
import { NoteDismissible } from "@/components/common/note-dismissible";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
Section,
SectionDescription,
@@ -15,6 +22,7 @@ import {
} from "@/components/content/section";
import { columns } from "@/components/data-table/status-pages/columns";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { DataTableSkeleton } from "@/components/ui/data-table/data-table-skeleton";
import { useTRPC } from "@/lib/trpc/client";
@@ -47,6 +55,29 @@ export function Client() {
columns={columns}
data={statusPages}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <StatusPage />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No status pages yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ A status page shows the health of your components to your users,
+ with every report and maintenance posted on it.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" asChild>
+ <Link href="/status-pages/create">Create status page</Link>
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <Link href="https://status.openstatus.dev" target="_blank">
+ <ExternalLink />
+ See an example
+ </Link>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
</Section>
</SectionGroup>
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx
index 45eed1e1a..2f29d33ba 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/history/client.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Info, Lock } from "@openstatus/icons";
+import { Calendar, Info, Lock } from "@openstatus/icons";
import { Tabs, TabsList, TabsTrigger } from "@openstatus/ui/components/ui/tabs";
import { useQuery } from "@tanstack/react-query";
import { format } from "date-fns";
@@ -17,8 +17,8 @@ import {
BillingOverlayDescription,
} from "@/components/content/billing-overlay";
import {
- EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -47,6 +47,7 @@ import {
MetricCardValue,
} from "@/components/metric/metric-card";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import {
HISTORY_WINDOWS,
@@ -188,28 +189,28 @@ export function Client() {
limit="uptime-history"
/>
</BillingOverlayContainer>
- ) : hasAnyData ? (
+ ) : (
<div className="overflow-x-auto">
<DataTable
paginationComponent={DataTablePaginationSimple}
columns={columns}
- data={history.rows}
+ // rows without a single value are not history yet
+ data={hasAnyData ? history.rows : []}
columnVisibility={columnVisibility}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Calendar />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No history yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ The first snapshot freezes on the 10th of next month. Until
+ then, the current month is served live.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
/>
</div>
- ) : (
- <EmptyStateContainer>
- <EmptyStateTitle>No history yet</EmptyStateTitle>
- <EmptyStateDescription>
- The first{" "}
- <span className="text-foreground font-medium">snapshot</span>{" "}
- freezes on the{" "}
- <span className="text-foreground font-medium">
- 10th of next month
- </span>{" "}
- — until then, the current month is served live.
- </EmptyStateDescription>
- </EmptyStateContainer>
)}
<HintCollapsible>
<HintCollapsibleTrigger>
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx
index 5f633c506..f6ffa60b7 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/(list)/page.tsx
@@ -1,11 +1,20 @@
"use client";
+import { Maintenance } from "@openstatus/icons";
import { Button } from "@openstatus/ui/components/ui/button";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import NextLink from "next/link";
import { useParams } from "next/navigation";
+import { useState } from "react";
import { toast } from "sonner";
import { Link } from "@/components/common/link";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
Section,
SectionDescription,
@@ -18,6 +27,7 @@ import { columns } from "@/components/data-table/maintenances/columns";
import { FormSheetMaintenance } from "@/components/forms/maintenance/sheet";
import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
import { errorMessage } from "@/lib/trpc/error";
@@ -26,6 +36,7 @@ export default function Page() {
const { id } = useParams<{ id: string }>();
const trpc = useTRPC();
const queryClient = useQueryClient();
+ const [openCreate, setOpenCreate] = useState(false);
const { data: statusPage } = useQuery(
trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
);
@@ -59,6 +70,26 @@ export default function Page() {
if (!statusPage || !maintenances) return null;
+ const items = toCheckboxTreeItems(
+ statusPage.pageComponents,
+ statusPage.pageComponentGroups,
+ );
+ const createMaintenance = async (
+ values: Parameters<
+ React.ComponentProps<typeof FormSheetMaintenance>["onSubmit"]
+ >[0],
+ ) => {
+ await createMaintenanceMutation.mutateAsync({
+ pageId: Number.parseInt(id),
+ title: values.title,
+ message: values.message ?? "",
+ startDate: values.startDate,
+ endDate: values.endDate,
+ pageComponents: values.pageComponents,
+ notifySubscribers: values.notifySubscribers,
+ });
+ };
+
return (
<SectionGroup>
<Section>
@@ -75,21 +106,10 @@ export default function Page() {
</SectionHeader>
<div>
<FormSheetMaintenance
- items={toCheckboxTreeItems(
- statusPage.pageComponents,
- statusPage.pageComponentGroups,
- )}
- onSubmit={async (values) => {
- await createMaintenanceMutation.mutateAsync({
- pageId: Number.parseInt(id),
- title: values.title,
- message: values.message ?? "",
- startDate: values.startDate,
- endDate: values.endDate,
- pageComponents: values.pageComponents,
- notifySubscribers: values.notifySubscribers,
- });
- }}
+ open={openCreate}
+ onOpenChange={setOpenCreate}
+ items={items}
+ onSubmit={createMaintenance}
>
<Button data-section="action" size="sm">
Create Maintenance
@@ -101,6 +121,29 @@ export default function Page() {
paginationComponent={DataTablePaginationSimple}
columns={columns}
data={maintenances}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Maintenance />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No maintenance scheduled</EmptyStateTitle>
+ <EmptyStateDescription>
+ Announce planned downtime ahead of time. During the window the
+ affected components show as under maintenance instead of
+ triggering alerts.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" onClick={() => setOpenCreate(true)}>
+ Schedule maintenance
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink href={`/status-pages/${id}/status-reports`}>
+ View status reports
+ </NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
</Section>
</SectionGroup>
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx
index 113f2f073..4d9061e23 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/(list)/page.tsx
@@ -1,14 +1,21 @@
"use client";
-import { Impact } from "@openstatus/icons";
+import { ExternalLink, Impact, Success } from "@openstatus/icons";
import { Button } from "@openstatus/ui/components/ui/button";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import NextLink from "next/link";
import { useParams } from "next/navigation";
+import { useState } from "react";
import { Link } from "@/components/common/link";
import { NoteButton } from "@/components/common/note";
import { NoteDismissible } from "@/components/common/note-dismissible";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
Section,
SectionDescription,
@@ -21,13 +28,16 @@ import { columns } from "@/components/data-table/status-reports/columns";
import { FormSheetStatusReport } from "@/components/forms/status-report/sheet";
import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
+import { getPageUrl } from "@/data/status-pages.client";
import { useTRPC } from "@/lib/trpc/client";
export default function Page() {
const { id } = useParams<{ id: string }>();
const trpc = useTRPC();
const queryClient = useQueryClient();
+ const [openCreate, setOpenCreate] = useState(false);
const { data: page } = useQuery(
trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
);
@@ -58,6 +68,40 @@ export default function Page() {
const hasUnresolvedIssue = statusReports.some(
(report) => report.status !== "resolved",
);
+ const items = toCheckboxTreeItems(
+ page.pageComponents,
+ page.pageComponentGroups,
+ );
+ const createStatusReport = async (
+ values: Parameters<
+ React.ComponentProps<typeof FormSheetStatusReport>["onSubmit"]
+ >[0],
+ ) => {
+ // NOTE: for type safety, we need to check if the values have a date property
+ // because of the union type
+ if ("date" in values) {
+ // every selected component gets an impact row — fresh
+ // reports are never legacy; fallback must match the
+ // picker's defaultImpact
+ const componentImpacts = values.pageComponents.map((pageComponentId) => ({
+ pageComponentId,
+ impact:
+ values.componentImpacts?.find(
+ (ci) => ci.pageComponentId === pageComponentId,
+ )?.impact ?? ("degraded_performance" as const),
+ }));
+ await createStatusReportMutation.mutateAsync({
+ title: values.title,
+ status: values.status,
+ pageId: Number.parseInt(id),
+ pageComponents: values.pageComponents,
+ componentImpacts,
+ date: values.date,
+ message: values.message,
+ notifySubscribers: values.notifySubscribers,
+ });
+ }
+ };
return (
<SectionGroup>
@@ -87,6 +131,8 @@ export default function Page() {
</SectionHeader>
<div>
<FormSheetStatusReport
+ open={openCreate}
+ onOpenChange={setOpenCreate}
warning={
hasUnresolvedIssue ? (
<>
@@ -96,38 +142,8 @@ export default function Page() {
</>
) : undefined
}
- items={toCheckboxTreeItems(
- page.pageComponents,
- page.pageComponentGroups,
- )}
- onSubmit={async (values) => {
- // NOTE: for type safety, we need to check if the values have a date property
- // because of the union type
- if ("date" in values) {
- // every selected component gets an impact row — fresh
- // reports are never legacy; fallback must match the
- // picker's defaultImpact
- const componentImpacts = values.pageComponents.map(
- (pageComponentId) => ({
- pageComponentId,
- impact:
- values.componentImpacts?.find(
- (ci) => ci.pageComponentId === pageComponentId,
- )?.impact ?? ("degraded_performance" as const),
- }),
- );
- await createStatusReportMutation.mutateAsync({
- title: values.title,
- status: values.status,
- pageId: Number.parseInt(id),
- pageComponents: values.pageComponents,
- componentImpacts,
- date: values.date,
- message: values.message,
- notifySubscribers: values.notifySubscribers,
- });
- }
- }}
+ items={items}
+ onSubmit={createStatusReport}
>
<Button data-section="action" size="sm">
Create Status Report
@@ -139,6 +155,34 @@ export default function Page() {
paginationComponent={DataTablePaginationSimple}
columns={columns}
data={statusReports}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia variant="success">
+ <Success />
+ </EmptyStateMedia>
+ <EmptyStateTitle>Nothing to report</EmptyStateTitle>
+ <EmptyStateDescription>
+ Nothing has been published on this page. When something breaks,
+ post a report here to keep visitors informed, and notify your
+ subscribers by email.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" onClick={() => setOpenCreate(true)}>
+ Create a report
+ </Button>
+ <Button size="sm" variant="outline" asChild>
+ <NextLink
+ href={getPageUrl(page)}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <ExternalLink />
+ Open public page
+ </NextLink>
+ </Button>
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
</Section>
</SectionGroup>
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
index d6a687885..02cb7baf0 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
@@ -1,9 +1,10 @@
"use client";
import type { RouterOutputs } from "@openstatus/api";
-import { Lock, Add } from "@openstatus/icons";
+import { Lock, Add, Email, ExternalLink } from "@openstatus/icons";
import { Button } from "@openstatus/ui/components/ui/button";
import { useMutation, useQuery } from "@tanstack/react-query";
+import NextLink from "next/link";
import { notFound, useParams } from "next/navigation";
import { useState } from "react";
@@ -15,8 +16,9 @@ import {
BillingOverlayDescription,
} from "@/components/content/billing-overlay";
import {
- EmptyStateContainer,
+ EmptyStateActions,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import {
@@ -33,7 +35,9 @@ import { UpgradeDialog } from "@/components/dialogs/upgrade";
import { FormSheetSubscriber } from "@/components/forms/subscriber/sheet";
import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
+import { getPageUrl } from "@/data/status-pages.client";
import { useTRPC } from "@/lib/trpc/client";
type Subscriber = RouterOutputs["pageSubscriber"]["list"][number];
@@ -190,21 +194,43 @@ export default function Page() {
limit="status-subscribers"
/>
</BillingOverlayContainer>
- ) : subscribers?.length ? (
+ ) : subscribers ? (
<DataTable
columns={columns}
data={subscribers}
toolbarComponent={SubscribersDataTableToolbar}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Email />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No subscribers yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ Visitors subscribe from the public page and get an email on
+ every update. You can also add people by hand.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button size="sm" onClick={() => setOpenAdd(true)}>
+ Add subscriber
+ </Button>
+ {page ? (
+ <Button size="sm" variant="outline" asChild>
+ <NextLink
+ href={getPageUrl(page)}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <ExternalLink />
+ Open public page
+ </NextLink>
+ </Button>
+ ) : null}
+ </EmptyStateActions>
+ </DataTableEmpty>
+ }
/>
- ) : (
- <EmptyStateContainer>
- <EmptyStateTitle>No subscribers</EmptyStateTitle>
- <EmptyStateDescription>
- Nobody has been subscribed to this status page.
- </EmptyStateDescription>
- </EmptyStateContainer>
- )}
+ ) : null}
</Section>
</SectionGroup>
);
diff --git a/apps/dashboard/src/app/login/_components/email-form.tsx b/apps/dashboard/src/app/login/_components/email-form.tsx
index 8a00211a7..75eac9c50 100644
--- a/apps/dashboard/src/app/login/_components/email-form.tsx
+++ b/apps/dashboard/src/app/login/_components/email-form.tsx
@@ -57,7 +57,7 @@ export function EmailForm({
if (state.sent) {
return (
- <EmptyStateContainer className="py-8">
+ <EmptyStateContainer>
<Email className="text-muted-foreground size-5" />
<EmptyStateTitle>Check your inbox</EmptyStateTitle>
<EmptyStateDescription className="text-pretty">
diff --git a/apps/dashboard/src/app/login/_components/login-button.tsx b/apps/dashboard/src/app/login/_components/login-button.tsx
index 2225549ea..efb33108c 100644
--- a/apps/dashboard/src/app/login/_components/login-button.tsx
+++ b/apps/dashboard/src/app/login/_components/login-button.tsx
@@ -29,11 +29,7 @@ export function LoginButton({
return (
<Button
variant={variant}
- className={cn(
- "relative w-full",
- isLastUsed && "border-primary border",
- className,
- )}
+ className={cn("relative w-full", className)}
onClick={(e) => {
localStorage.setItem(STORAGE_KEY, provider);
onClick?.(e);
@@ -44,7 +40,8 @@ export function LoginButton({
{isLastUsed ? (
<Badge
variant="outline"
- className="text-muted-foreground absolute top-1/2 right-2 -translate-y-1/2 px-1.5 text-[10px] font-normal"
+ // inherits the button's text color so it reads on both variants
+ className="absolute top-1/2 right-2 -translate-y-1/2 border-transparent bg-current/10 px-1.5 text-[10px] font-normal text-current opacity-80"
>
Last used
</Badge>
diff --git a/apps/dashboard/src/components/chart/chart-empty.tsx b/apps/dashboard/src/components/chart/chart-empty.tsx
new file mode 100644
index 000000000..8a9b7a283
--- /dev/null
+++ b/apps/dashboard/src/components/chart/chart-empty.tsx
@@ -0,0 +1,19 @@
+import { EmptyStateContainer } from "@/components/content/empty-state";
+import { cn } from "@/lib/utils";
+
+/** Fills a chart's slot at the chart's height so a resolving fetch never shifts the page. */
+export function ChartEmpty({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof EmptyStateContainer>) {
+ return (
+ <EmptyStateContainer
+ data-slot="chart-empty"
+ className={cn("h-[250px] py-2", className)}
+ {...props}
+ >
+ {children}
+ </EmptyStateContainer>
+ );
+}
diff --git a/apps/dashboard/src/components/content/empty-state.tsx b/apps/dashboard/src/components/content/empty-state.tsx
index 830ec1bbb..cc42a3312 100644
--- a/apps/dashboard/src/components/content/empty-state.tsx
+++ b/apps/dashboard/src/components/content/empty-state.tsx
@@ -1,15 +1,27 @@
+import { type VariantProps, cva } from "class-variance-authority";
+
import { cn } from "@/lib/utils";
+/**
+ * Icon, what belongs here, why it is empty, one action, one escape hatch.
+ * `inline` is the single-row size for inside a table or card; `plain` drops
+ * the dashed border when the parent already draws one.
+ */
export function EmptyStateContainer({
children,
className,
+ inline,
+ plain,
...props
-}: React.ComponentProps<"div">) {
+}: React.ComponentProps<"div"> & { inline?: boolean; plain?: boolean }) {
return (
<div
data-slot="empty-state-container"
+ data-inline={inline ? "" : undefined}
className={cn(
- "border-border flex h-full flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-4",
+ "border-border flex h-full flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-4 py-8 text-center",
+ inline && "flex-row flex-wrap gap-2 py-3 text-left",
+ plain && "border-0",
className,
)}
{...props}
@@ -19,6 +31,44 @@ export function EmptyStateContainer({
);
}
+const emptyStateMediaVariants = cva(
+ "bg-background flex size-9 shrink-0 items-center justify-center rounded-lg border in-data-[inline]:size-auto in-data-[inline]:border-0 in-data-[inline]:bg-transparent [&_svg]:size-4",
+ {
+ variants: {
+ variant: {
+ default: "border-border text-muted-foreground",
+ // opaque tint so ghost rows never show through
+ success:
+ "border-success/20 text-success bg-[color-mix(in_oklab,var(--success)_10%,var(--background))]",
+ warning:
+ "border-warning/20 text-warning bg-[color-mix(in_oklab,var(--warning)_10%,var(--background))]",
+ destructive:
+ "border-destructive/20 text-destructive bg-[color-mix(in_oklab,var(--destructive)_10%,var(--background))]",
+ info: "border-info/20 text-info bg-[color-mix(in_oklab,var(--info)_10%,var(--background))]",
+ },
+ },
+ defaultVariants: { variant: "default" },
+ },
+);
+
+export function EmptyStateMedia({
+ children,
+ className,
+ variant,
+ ...props
+}: React.ComponentProps<"div"> & VariantProps<typeof emptyStateMediaVariants>) {
+ return (
+ <div
+ data-slot="empty-state-media"
+ aria-hidden
+ className={cn(emptyStateMediaVariants({ variant }), className)}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+}
+
export function EmptyStateTitle({
children,
className,
@@ -27,7 +77,10 @@ export function EmptyStateTitle({
return (
<p
data-slot="empty-state-title"
- className={cn("text-foreground", className)}
+ className={cn(
+ "text-foreground text-sm font-medium in-data-[inline]:font-normal",
+ className,
+ )}
{...props}
>
{children}
@@ -43,10 +96,32 @@ export function EmptyStateDescription({
return (
<p
data-slot="empty-state-description"
- className={cn("text-muted-foreground text-center text-sm", className)}
+ className={cn(
+ "text-muted-foreground max-w-sm text-sm text-balance in-data-[inline]:max-w-none",
+ className,
+ )}
{...props}
>
{children}
</p>
);
}
+
+export function EmptyStateActions({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="empty-state-actions"
+ className={cn(
+ "mt-2 flex flex-wrap items-center justify-center gap-2 in-data-[inline]:mt-0 in-data-[inline]:ml-auto",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+}
diff --git a/apps/dashboard/src/components/data-table/audit-logs-workspace/columns.tsx b/apps/dashboard/src/components/data-table/audit-logs-workspace/columns.tsx
index bb3abb17f..d4434d7cf 100644
--- a/apps/dashboard/src/components/data-table/audit-logs-workspace/columns.tsx
+++ b/apps/dashboard/src/components/data-table/audit-logs-workspace/columns.tsx
@@ -178,7 +178,7 @@ export const columns: ColumnDef<AuditLog>[] = [
},
{
accessorKey: "actorType",
- header: () => null,
+ header: "",
cell: () => null,
enableHiding: true,
filterFn: (row, id, filterValue: string[]) => {
@@ -188,7 +188,7 @@ export const columns: ColumnDef<AuditLog>[] = [
},
{
accessorKey: "entityType",
- header: () => null,
+ header: "",
cell: () => null,
enableHiding: true,
filterFn: (row, id, filterValue: string[]) => {
diff --git a/apps/dashboard/src/components/data-table/audit-logs/columns.tsx b/apps/dashboard/src/components/data-table/audit-logs/columns.tsx
index dc5961de5..064ace95a 100644
--- a/apps/dashboard/src/components/data-table/audit-logs/columns.tsx
+++ b/apps/dashboard/src/components/data-table/audit-logs/columns.tsx
@@ -20,7 +20,7 @@ export function getColumns(
{
id: "icon",
accessorFn: (row) => row.action,
- header: () => null,
+ header: "",
enableSorting: false,
enableHiding: false,
cell: ({ row }) => {
diff --git a/apps/dashboard/src/components/data-table/audit-logs/wrapper.tsx b/apps/dashboard/src/components/data-table/audit-logs/wrapper.tsx
index b161f08c8..5e6f3bbfb 100644
--- a/apps/dashboard/src/components/data-table/audit-logs/wrapper.tsx
+++ b/apps/dashboard/src/components/data-table/audit-logs/wrapper.tsx
@@ -1,16 +1,18 @@
"use client";
+import { AuditLog } from "@openstatus/icons";
import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
import { useQuery } from "@tanstack/react-query";
import { useMemo } from "react";
import { BlockWrapper } from "@/components/content/block-wrapper";
import {
- EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -46,26 +48,28 @@ export function AuditLogsWrapper({
);
}
- if (!auditLogs?.data || auditLogs.data.length === 0) {
- return (
- <EmptyStateContainer>
- <EmptyStateTitle>No audit logs</EmptyStateTitle>
- <EmptyStateDescription>
- No audit logs found for this monitor.
- </EmptyStateDescription>
- </EmptyStateContainer>
- );
- }
-
- return (
- <BlockWrapper>
- <DataTable
- columns={columns}
- data={auditLogs.data}
- paginationComponent={DataTablePaginationSimple}
- />
- </BlockWrapper>
+ const rows = auditLogs?.data ?? [];
+ const table = (
+ <DataTable
+ columns={columns}
+ data={rows}
+ paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <AuditLog />
+ </EmptyStateMedia>
+ <EmptyStateTitle>Nothing yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ Status changes, downtime and sent alerts show up here.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
+ />
);
+
+ // the collapse overlay would sit on top of the empty state
+ return rows.length ? <BlockWrapper>{table}</BlockWrapper> : table;
}
export default AuditLogsWrapper;
diff --git a/apps/dashboard/src/components/data-table/incidents/columns.tsx b/apps/dashboard/src/components/data-table/incidents/columns.tsx
index 082d03b33..f6fb98c77 100644
--- a/apps/dashboard/src/components/data-table/incidents/columns.tsx
+++ b/apps/dashboard/src/components/data-table/incidents/columns.tsx
@@ -81,7 +81,7 @@ const baseColumns: ColumnDef<Incident>[] = [
const declareColumn: ColumnDef<Incident> = {
id: "declare",
- header: () => null,
+ header: "",
cell: ({ row }) =>
row.original.resolvedAt ? null : (
<DeclareFromRow
diff --git a/apps/dashboard/src/components/data-table/monitors/columns.tsx b/apps/dashboard/src/components/data-table/monitors/columns.tsx
index e79f61d35..174834a17 100644
--- a/apps/dashboard/src/components/data-table/monitors/columns.tsx
+++ b/apps/dashboard/src/components/data-table/monitors/columns.tsx
@@ -26,6 +26,7 @@ type Monitor = RouterOutputs["monitor"]["list"][number] & {
export const columns: ColumnDef<Monitor>[] = [
{
id: "select",
+ meta: { ghost: false },
header: ({ table }) => (
<Checkbox
checked={
@@ -65,16 +66,16 @@ export const columns: ColumnDef<Monitor>[] = [
}
},
filterFn: (row, _, value) => {
- if (Array.isArray(value)) {
- if (value.includes("inactive")) {
- return !row.original.active;
- }
- if (value.includes("active")) {
+ const statuses: string[] = Array.isArray(value) ? value : [value];
+ // "inactive" is a paused monitor, "active" a running healthy one;
+ // every other status matches the monitor's status as-is
+ return statuses.some((status) => {
+ if (status === "inactive") return !row.original.active;
+ if (status === "active") {
return !!row.original.active && row.original.status === "active";
}
- return value.includes(row.original.status);
- }
- return row.original.status === value;
+ return row.original.status === status;
+ });
},
enableSorting: false,
enableHiding: false,
@@ -82,6 +83,7 @@ export const columns: ColumnDef<Monitor>[] = [
meta: {
headerClassName: "pr-0",
cellClassName: "w-8 pr-0",
+ ghost: false,
},
},
{
@@ -234,7 +236,7 @@ export const columns: ColumnDef<Monitor>[] = [
cell: ({ row }) => {
const value = row.getValue("p50");
if (value === undefined) return <TableCellSkeleton />;
- if (!value) return <TableCellEmpty>No data</TableCellEmpty>;
+ if (!value) return <TableCellEmpty>—</TableCellEmpty>;
return <TableCellNumber value={value} unit="ms" />;
},
enableHiding: false,
@@ -251,7 +253,7 @@ export const columns: ColumnDef<Monitor>[] = [
cell: ({ row }) => {
const value = row.getValue("p90");
if (value === undefined) return <TableCellSkeleton />;
- if (!value) return <TableCellEmpty>No data</TableCellEmpty>;
+ if (!value) return <TableCellEmpty>—</TableCellEmpty>;
return <TableCellNumber value={value} unit="ms" />;
},
enableHiding: false,
@@ -269,7 +271,7 @@ export const columns: ColumnDef<Monitor>[] = [
cell: ({ row }) => {
const value = row.getValue("p95");
if (value === undefined) return <TableCellSkeleton />;
- if (!value) return <TableCellEmpty>No data</TableCellEmpty>;
+ if (!value) return <TableCellEmpty>—</TableCellEmpty>;
return <TableCellNumber value={value} unit="ms" />;
},
enableHiding: false,
diff --git a/apps/dashboard/src/components/data-table/overview-events/columns.tsx b/apps/dashboard/src/components/data-table/overview-events/columns.tsx
index a18a94d20..dedb17d43 100644
--- a/apps/dashboard/src/components/data-table/overview-events/columns.tsx
+++ b/apps/dashboard/src/components/data-table/overview-events/columns.tsx
@@ -17,7 +17,6 @@ import { TableCellDate } from "@/components/data-table/table-cell-date";
import { TableCellLink } from "@/components/data-table/table-cell-link";
import { TableCellNumber } from "@/components/data-table/table-cell-number";
import { FormSheetStatusReportUpdateCreate } from "@/components/forms/status-report-update/sheet-create";
-import { DataTableColumnHeader } from "@/components/ui/data-table/data-table-column-header";
import { statusConfig as managedIncidentStatusConfig } from "@/data/managed-incidents.client";
import {
type OverviewEvent,
@@ -82,7 +81,7 @@ const baseColumns: ColumnDef<OverviewEvent>[] = [
{
id: "type",
accessorFn: (row) => row.type,
- header: () => null,
+ header: "",
cell: ({ row }) => {
const config = eventTypeConfig[row.original.type];
return (
@@ -134,9 +133,8 @@ const baseColumns: ColumnDef<OverviewEvent>[] = [
{
id: "startedAt",
accessorFn: (row) => getStartedAt(row),
- header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Start" />
- ),
+ // sortable so the page's defaultSorting applies, but no toggle in the header
+ header: "Start",
cell: ({ row }) => <TableCellDate value={row.getValue("startedAt")} />,
enableHiding: false,
meta: {
@@ -173,7 +171,7 @@ const baseColumns: ColumnDef<OverviewEvent>[] = [
const actionColumn: ColumnDef<OverviewEvent> = {
id: "action",
- header: () => null,
+ header: "",
cell: ({ row }) => {
const event = row.original;
switch (event.type) {
diff --git a/apps/dashboard/src/components/data-table/response-logs/columns.tsx b/apps/dashboard/src/components/data-table/response-logs/columns.tsx
index d178e63be..ca09dc68a 100644
--- a/apps/dashboard/src/components/data-table/response-logs/columns.tsx
+++ b/apps/dashboard/src/components/data-table/response-logs/columns.tsx
@@ -29,7 +29,7 @@ export function getColumns(
return [
{
accessorKey: "requestStatus",
- header: () => null,
+ header: "",
enableSorting: false,
enableHiding: false,
cell: ({ row }) => {
diff --git a/apps/dashboard/src/components/data-table/response-logs/regions/columns.tsx b/apps/dashboard/src/components/data-table/response-logs/regions/columns.tsx
index 88f359cdd..445a3b7ac 100644
--- a/apps/dashboard/src/components/data-table/response-logs/regions/columns.tsx
+++ b/apps/dashboard/src/components/data-table/response-logs/regions/columns.tsx
@@ -233,11 +233,14 @@ export function getColumns({
max,
loading,
degradedAfter,
+ empty,
}: {
privateLocations: PrivateLocation[];
max: number;
loading: boolean;
degradedAfter: number | null;
+ /** No rows: the axis would squeeze into a collapsed column. */
+ empty?: boolean;
}): ColumnDef<RegionMetric>[] {
return [
{
@@ -266,7 +269,8 @@ export function getColumns({
},
{
id: "spread",
- header: () => (loading ? null : <RangePlotAxis max={max} unit="ms" />),
+ header: () =>
+ loading || empty ? null : <RangePlotAxis max={max} unit="ms" />,
cell: ({ row }) => (
<SpreadCell
metric={row.original}
diff --git a/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx b/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx
index 4dddab44b..b249039be 100644
--- a/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx
+++ b/apps/dashboard/src/components/data-table/response-logs/regions/data-table.tsx
@@ -1,14 +1,23 @@
"use client";
import type { PrivateLocation } from "@openstatus/db/src/schema";
+import { Globe } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
import { cn } from "@openstatus/ui/lib/utils";
import { useMemo } from "react";
+import {
+ EmptyStateActions,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import {
RangePlotLegend,
RangePlotLegendItem,
} from "@/components/content/range-plot";
import { DataTable } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { getRegionAxisMax } from "@/data/metrics.client";
import type { RegionMetric } from "@/data/region-metrics";
@@ -45,17 +54,34 @@ export function RegionsDataTable({
privateLocations,
loading,
degradedAfter,
+ filteredOut,
+ onShowAll,
}: {
data: RegionMetric[];
privateLocations: PrivateLocation[];
loading: boolean;
/** Values above it render in the warning color. */
degradedAfter: number | null;
+ /** The region filter left none of the configured regions. */
+ filteredOut?: boolean;
+ onShowAll?: () => void;
}) {
const max = useMemo(() => getRegionAxisMax(data), [data]);
+ // only when no region reported at all; a single dead region keeps its row
+ const reported = useMemo(
+ () => (!loading && data.every((row) => row.buckets === 0) ? [] : data),
+ [data, loading],
+ );
const columns = useMemo(
- () => getColumns({ privateLocations, max, loading, degradedAfter }),
- [privateLocations, max, loading, degradedAfter],
+ () =>
+ getColumns({
+ privateLocations,
+ max,
+ loading,
+ degradedAfter,
+ empty: reported.length === 0,
+ }),
+ [privateLocations, max, loading, degradedAfter, reported.length],
);
return (
@@ -71,9 +97,51 @@ export function RegionsDataTable({
<DataTable
paginationComponent={DataTablePaginationSimple}
defaultPagination={{ pageIndex: 0, pageSize: 50 }}
- data={data}
+ data={reported}
columns={columns}
defaultSorting={[{ id: "p50", desc: false }]}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Globe />
+ </EmptyStateMedia>
+ {filteredOut ? (
+ <>
+ <EmptyStateTitle>
+ No regions match the selected filter
+ </EmptyStateTitle>
+ <EmptyStateDescription>
+ Pick a region configured on this monitor to compare latency
+ per region.
+ </EmptyStateDescription>
+ {onShowAll ? (
+ <EmptyStateActions>
+ <Button size="sm" variant="outline" onClick={onShowAll}>
+ Show all regions
+ </Button>
+ </EmptyStateActions>
+ ) : null}
+ </>
+ ) : data.length === 0 ? (
+ <>
+ <EmptyStateTitle>No regions configured</EmptyStateTitle>
+ <EmptyStateDescription>
+ Add a region or private location to the monitor to compare
+ latency per region.
+ </EmptyStateDescription>
+ </>
+ ) : (
+ <>
+ <EmptyStateTitle>No checks in this period</EmptyStateTitle>
+ <EmptyStateDescription>
+ None of the {data.length}{" "}
+ {data.length === 1 ? "region" : "regions"} reported. Pick a
+ longer period or wait for the next check.
+ </EmptyStateDescription>
+ </>
+ )}
+ </DataTableEmpty>
+ }
/>
</div>
);
diff --git a/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx b/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx
index 18ff576e4..fb5b0fb38 100644
--- a/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx
+++ b/apps/dashboard/src/components/data-table/settings/api-key/columns.tsx
@@ -78,6 +78,7 @@ export const columns: ColumnDef<ApiKey>[] = [
{
id: "actions",
header: () => <span className="sr-only">Actions</span>,
+ meta: { ghost: false },
cell: ({ row }) => <DataTableRowActions row={row} />,
},
];
diff --git a/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx b/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx
index 568e07f77..07594c19e 100644
--- a/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx
+++ b/apps/dashboard/src/components/data-table/settings/api-key/data-table.tsx
@@ -1,6 +1,13 @@
import type { RouterOutputs } from "@openstatus/api";
+import { ApiKey as ApiKeyIcon } from "@openstatus/icons";
+import {
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
import { DataTable as DataTableBase } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { columns } from "./columns";
@@ -13,6 +20,18 @@ export function DataTable({ apiKeys }: { apiKeys: ApiKey[] }) {
columns={columns}
data={apiKeys}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <ApiKeyIcon />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No API keys yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ A key lets the CLI, CI/CD and your own scripts read and write
+ workspace data via the API.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
/>
);
}
diff --git a/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx b/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx
index 849232277..4cbea26de 100644
--- a/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx
+++ b/apps/dashboard/src/components/data-table/settings/connected-apps/columns.tsx
@@ -65,6 +65,7 @@ export const columns: ColumnDef<Grant>[] = [
{
id: "actions",
header: () => <span className="sr-only">Actions</span>,
+ meta: { ghost: false },
cell: ({ row }) => <DataTableRowActions row={row} />,
},
];
diff --git a/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx b/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx
index 793385d93..510976e4a 100644
--- a/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx
+++ b/apps/dashboard/src/components/data-table/settings/invitations/columns.tsx
@@ -31,6 +31,7 @@ export const columns: ColumnDef<Invitation>[] = [
{
id: "actions",
header: () => <span className="sr-only">Actions</span>,
+ meta: { ghost: false },
cell: ({ row }) => <DataTableRowActions row={row} />,
},
];
diff --git a/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx b/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx
index 1d25d173a..41e56114e 100644
--- a/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx
+++ b/apps/dashboard/src/components/data-table/settings/invitations/data-table.tsx
@@ -1,11 +1,13 @@
+import { Invite } from "@openstatus/icons";
import { useQuery } from "@tanstack/react-query";
import {
- EmptyStateContainer,
EmptyStateDescription,
+ EmptyStateMedia,
EmptyStateTitle,
} from "@/components/content/empty-state";
import { DataTable as DataTableBase } from "@/components/ui/data-table/data-table";
+import { DataTableEmpty } from "@/components/ui/data-table/data-table-empty";
import { DataTablePaginationSimple } from "@/components/ui/data-table/data-table-pagination";
import { useTRPC } from "@/lib/trpc/client";
@@ -17,22 +19,23 @@ export function DataTable() {
if (!invitations) return null;
- if (invitations.length === 0) {
- return (
- <EmptyStateContainer>
- <EmptyStateTitle>No pending invitations</EmptyStateTitle>
- <EmptyStateDescription>
- Only active invitations are shown here.
- </EmptyStateDescription>
- </EmptyStateContainer>
- );
- }
-
return (
<DataTableBase
columns={columns}
data={invitations}
paginationComponent={DataTablePaginationSimple}
+ emptyState={
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Invite />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No pending invitations</EmptyStateTitle>
+ <EmptyStateDescription>
+ Invite a member below. Accepted and expired invitations drop off
+ this list.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ }
/>
);
}
diff --git a/apps/dashboard/src/components/data-table/settings/members/columns.tsx b/apps/dashboard/src/components/data-table/settings/members/columns.tsx
index 158628ad4..ec0fb8e11 100644
--- a/apps/dashboard/src/components/data-table/settings/members/columns.tsx
+++ b/apps/dashboard/src/components/data-table/settings/members/columns.tsx
@@ -45,6 +45,7 @@ export const columns: ColumnDef<Member>[] = [
{
id: "actions",
header: () => <span className="sr-only">Actions</span>,
+ meta: { ghost: false },
cell: ({ row }) => <DataTableRowActions row={row} />,
},
];
diff --git a/apps/dashboard/src/components/data-table/table-cell-number.tsx b/apps/dashboard/src/components/data-table/table-cell-number.tsx
index 77cfeb85c..5e564ab6f 100644
--- a/apps/dashboard/src/components/data-table/table-cell-number.tsx
+++ b/apps/dashboard/src/components/data-table/table-cell-number.tsx
@@ -22,7 +22,7 @@ export function TableCellNumber({
value,
className,
unit,
- empty = "No data",
+ empty = "—",
variant,
...props
}: React.ComponentProps<"div"> &
diff --git a/apps/dashboard/src/components/forms/maintenance/sheet-create.tsx b/apps/dashboard/src/components/forms/maintenance/sheet-create.tsx
index e88b5a3c3..2082aea5b 100644
--- a/apps/dashboard/src/components/forms/maintenance/sheet-create.tsx
+++ b/apps/dashboard/src/components/forms/maintenance/sheet-create.tsx
@@ -51,7 +51,10 @@ export function FormSheetMaintenanceCreate({
}) {
const [internalOpen, setInternalOpen] = useState(false);
const open = controlledOpen ?? internalOpen;
- const setOpen = onOpenChange ?? setInternalOpen;
+ const setOpen = (next: boolean) => {
+ if (controlledOpen === undefined) setInternalOpen(next);
+ onOpenChange?.(next);
+ };
const [selectedPageId, setSelectedPageId] = useState<number | null>(null);
const trpc = useTRPC();
const queryClient = useQueryClient();
diff --git a/apps/dashboard/src/components/forms/maintenance/sheet.tsx b/apps/dashboard/src/components/forms/maintenance/sheet.tsx
index f178a0a09..2596be883 100644
--- a/apps/dashboard/src/components/forms/maintenance/sheet.tsx
+++ b/apps/dashboard/src/components/forms/maintenance/sheet.tsx
@@ -25,19 +25,30 @@ export function FormSheetMaintenance({
defaultValues,
onSubmit,
items,
+ open: controlledOpen,
+ onOpenChange,
...props
}: Omit<React.ComponentProps<typeof FormSheetTrigger>, "onSubmit"> & {
defaultValues?: FormValues;
items: CheckboxTreeItem[];
onSubmit: (values: FormValues) => Promise<void>;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
}) {
- const [open, setOpen] = useState(false);
+ const [internalOpen, setInternalOpen] = useState(false);
+ const open = controlledOpen ?? internalOpen;
+ const setOpen = (next: boolean) => {
+ if (controlledOpen === undefined) setInternalOpen(next);
+ onOpenChange?.(next);
+ };
return (
<FormSheetWithDirtyProtection open={open} onOpenChange={setOpen}>
- <FormSheetTrigger {...props} asChild>
- {children}
- </FormSheetTrigger>
+ {children ? (
+ <FormSheetTrigger {...props} asChild>
+ {children}
+ </FormSheetTrigger>
+ ) : null}
<FormSheetContent className="sm:max-w-lg">
<FormSheetHeader>
<FormSheetTitle>Maintenance</FormSheetTitle>
diff --git a/apps/dashboard/src/components/forms/private-location/sheet-create.tsx b/apps/dashboard/src/components/forms/private-location/sheet-create.tsx
new file mode 100644
index 000000000..51c98d3c2
--- /dev/null
+++ b/apps/dashboard/src/components/forms/private-location/sheet-create.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+
+import { FormSheetPrivateLocation } from "@/components/forms/private-location/sheet";
+import { useTRPC } from "@/lib/trpc/client";
+
+/** Create sheet with the mutation attached. `children` is the trigger. */
+export function FormSheetPrivateLocationCreate({
+ children,
+ monitors,
+}: {
+ children: React.ReactNode;
+ monitors: React.ComponentProps<typeof FormSheetPrivateLocation>["monitors"];
+}) {
+ const trpc = useTRPC();
+ const queryClient = useQueryClient();
+ const createPrivateLocationMutation = useMutation(
+ trpc.privateLocation.new.mutationOptions({
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: trpc.privateLocation.list.queryKey(),
+ });
+ },
+ }),
+ );
+
+ return (
+ <FormSheetPrivateLocation
+ monitors={monitors}
+ onSubmit={async (values) => {
+ await createPrivateLocationMutation.mutateAsync({
+ name: values.name,
+ monitors: values.monitors,
+ token: values.token,
+ metadata: Object.fromEntries(
+ values.metadata.map((m) => [m.key, m.value]),
+ ),
+ });
+ }}
+ >
+ {children}
+ </FormSheetPrivateLocation>
+ );
+}
diff --git a/apps/dashboard/src/components/forms/settings/form-api-key.tsx b/apps/dashboard/src/components/forms/settings/form-api-key.tsx
index ee60e6817..200264add 100644
--- a/apps/dashboard/src/components/forms/settings/form-api-key.tsx
+++ b/apps/dashboard/src/components/forms/settings/form-api-key.tsx
@@ -4,11 +4,6 @@ import { Button } from "@openstatus/ui/components/ui/button";
import { useQuery } from "@tanstack/react-query";
import { Link } from "@/components/common/link";
-import {
- EmptyStateDescription,
- EmptyStateTitle,
-} from "@/components/content/empty-state";
-import { EmptyStateContainer } from "@/components/content/empty-state";
import { DataTable } from "@/components/data-table/settings/api-key/data-table";
import { CreateApiKeyDialog } from "@/components/forms/api-key/dialog";
import {
@@ -37,16 +32,7 @@ export function FormApiKey() {
</FormCardDescription>
</FormCardHeader>
<FormCardContent>
- {apiKeys.length === 0 ? (
- <EmptyStateContainer>
- <EmptyStateTitle>No API keys</EmptyStateTitle>
- <EmptyStateDescription>
- Access your data via API.
- </EmptyStateDescription>
- </EmptyStateContainer>
- ) : (
- <DataTable apiKeys={apiKeys} />
- )}
+ <DataTable apiKeys={apiKeys} />
</FormCardContent>
<FormCardFooter>
<FormCardFooterInfo>
diff --git a/apps/dashboard/src/components/forms/status-report/sheet-create.tsx b/apps/dashboard/src/components/forms/status-report/sheet-create.tsx
index 5339c47bc..bd67ccc6d 100644
--- a/apps/dashboard/src/components/forms/status-report/sheet-create.tsx
+++ b/apps/dashboard/src/components/forms/status-report/sheet-create.tsx
@@ -54,7 +54,10 @@ export function FormSheetStatusReportCreate({
}) {
const [internalOpen, setInternalOpen] = useState(false);
const open = controlledOpen ?? internalOpen;
- const setOpen = onOpenChange ?? setInternalOpen;
+ const setOpen = (next: boolean) => {
+ if (controlledOpen === undefined) setInternalOpen(next);
+ onOpenChange?.(next);
+ };
const [selectedPageId, setSelectedPageId] = useState<number | null>(null);
const trpc = useTRPC();
const queryClient = useQueryClient();
diff --git a/apps/dashboard/src/components/forms/status-report/sheet.tsx b/apps/dashboard/src/components/forms/status-report/sheet.tsx
index 226d77045..5779561c2 100644
--- a/apps/dashboard/src/components/forms/status-report/sheet.tsx
+++ b/apps/dashboard/src/components/forms/status-report/sheet.tsx
@@ -26,17 +26,28 @@ export function FormSheetStatusReport({
onSubmit,
items,
warning,
+ open: controlledOpen,
+ onOpenChange,
}: Omit<React.ComponentProps<typeof FormSheetTrigger>, "onSubmit"> & {
defaultValues?: FormValues;
onSubmit: (values: FormValues) => Promise<void>;
items: CheckboxTreeItem[];
warning?: React.ReactNode;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
}) {
- const [open, setOpen] = useState(false);
+ const [internalOpen, setInternalOpen] = useState(false);
+ const open = controlledOpen ?? internalOpen;
+ const setOpen = (next: boolean) => {
+ if (controlledOpen === undefined) setInternalOpen(next);
+ onOpenChange?.(next);
+ };
return (
<FormSheetWithDirtyProtection open={open} onOpenChange={setOpen}>
- <FormSheetTrigger asChild>{children}</FormSheetTrigger>
+ {children ? (
+ <FormSheetTrigger asChild>{children}</FormSheetTrigger>
+ ) : null}
<FormSheetContent className="sm:max-w-lg">
<FormSheetHeader>
<FormSheetTitle>Status Report</FormSheetTitle>
diff --git a/apps/dashboard/src/components/metric/global-uptime/section.tsx b/apps/dashboard/src/components/metric/global-uptime/section.tsx
index 7c91eac67..10c64d433 100644
--- a/apps/dashboard/src/components/metric/global-uptime/section.tsx
+++ b/apps/dashboard/src/components/metric/global-uptime/section.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useQuery } from "@tanstack/react-query";
+import type { RouterOutputs } from "@openstatus/api";
import { formatDistanceToNow } from "date-fns";
import {
@@ -12,13 +12,16 @@ import {
MetricCardTitle,
MetricCardValue,
} from "@/components/metric/metric-card";
-import { type PERIODS, mapMetrics, metricsCards } from "@/data/metrics.client";
+import {
+ hasMetricsData,
+ mapMetrics,
+ metricsCards,
+} from "@/data/metrics.client";
import {
formatMilliseconds,
formatNumber,
formatPercentage,
} from "@/lib/formatter";
-import { useTRPC } from "@/lib/trpc/client";
type Metric = {
label: string;
@@ -27,31 +30,15 @@ type Metric = {
variant: React.ComponentProps<typeof MetricCard>["variant"];
};
-// TODO: move the fetch to the parent component
// TODO: missing dynamic degraded
export function GlobalUptimeSection({
- monitorId,
- jobType,
- period = "7d",
- regions,
+ metrics,
+ isLoading,
}: {
- monitorId: string;
- jobType: "http" | "tcp" | "dns" | "icmp" | "grpc";
- period: (typeof PERIODS)[number];
- regions: string[] | undefined;
+ metrics: RouterOutputs["tinybird"]["metrics"] | undefined;
+ isLoading: boolean;
}) {
- const trpc = useTRPC();
-
- const { data: metrics, isLoading } = useQuery(
- trpc.tinybird.metrics.queryOptions({
- monitorId,
- period,
- type: jobType,
- regions,
- }),
- );
-
// Helper to transform the data the same way it used to be in the page
function defineMetrics() {
if (!metrics) return null;
@@ -70,7 +57,7 @@ export function GlobalUptimeSection({
const k = key as keyof typeof acc;
const v = (() => {
if (k === "lastTimestamp") {
- if (!value) return "N/A";
+ if (!value) return "—";
return formatDistanceToNow(new Date(value ?? 0), {
addSuffix: true,
});
@@ -123,6 +110,10 @@ export function GlobalUptimeSection({
);
}
+ const definedMetrics = defineMetrics();
+ // a window with no checks (or a failed fetch) has no uptime or latency
+ const noData = !metrics || !hasMetricsData(metrics);
+
const refinedMetrics: (Metric | null)[] = (
[
"uptime",
@@ -139,7 +130,15 @@ export function GlobalUptimeSection({
).map((key) => {
if (!key) return null;
const metric =
- defineMetrics()?.[key as keyof ReturnType<typeof mapMetrics>[number]];
+ definedMetrics?.[key as keyof ReturnType<typeof mapMetrics>[number]];
+ if (noData) {
+ return {
+ label: metricsCards[key].label,
+ value: key === "total" ? "0" : "—",
+ trend: null,
+ variant: metricsCards[key].variant,
+ } as Metric;
+ }
return {
label: metricsCards[key].label,
value: metric?.value ?? "0",
diff --git a/apps/dashboard/src/components/ui/data-table/data-table-empty.tsx b/apps/dashboard/src/components/ui/data-table/data-table-empty.tsx
new file mode 100644
index 000000000..1a4a58298
--- /dev/null
+++ b/apps/dashboard/src/components/ui/data-table/data-table-empty.tsx
@@ -0,0 +1,111 @@
+"use client";
+
+import { Filter } from "@openstatus/icons";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
+import { TableCell, TableRow } from "@openstatus/ui/components/ui/table";
+import type { Table } from "@tanstack/react-table";
+
+import {
+ EmptyStateActions,
+ EmptyStateContainer,
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
+import { cn } from "@/lib/utils";
+
+// pill widths cycle per cell so the ghost rows read as rows, not a grid
+const GHOST_WIDTHS = ["w-3/5", "w-2/5", "w-1/2", "w-1/3", "w-2/5"];
+const GHOST_ROWS = 5;
+// rows are h-10; the empty state pulls itself up by this much
+const GHOST_HEIGHT = `${GHOST_ROWS * 2.5}rem`;
+
+/** Real table rows, so the ghost cells share the header column widths. */
+export function DataTableGhostRows<TData>({ table }: { table: Table<TData> }) {
+ const columns = table.getVisibleLeafColumns();
+ // TanStack fills in a header for every column; only labeled ones get a pill.
+ // Internal API: if it ever goes away, unlabeled columns merely get a pill too.
+ const defaultHeader = table._getDefaultColumnDef?.().header;
+ const labeled = (column: (typeof columns)[number]) =>
+ column.columnDef.meta?.ghost !== false &&
+ column.columnDef.header !== defaultHeader &&
+ column.columnDef.header !== "";
+ return Array.from({ length: GHOST_ROWS }).map((_, row) => (
+ <TableRow key={row} aria-hidden className="h-10 hover:bg-transparent">
+ {columns.map((column, cell) => (
+ <TableCell
+ key={column.id}
+ className={column.columnDef.meta?.cellClassName}
+ >
+ {labeled(column) ? (
+ <Skeleton
+ className={cn(
+ // inline so the cell's text alignment positions the pill
+ "inline-block h-4 animate-none align-middle",
+ GHOST_WIDTHS[(row + cell) % GHOST_WIDTHS.length],
+ )}
+ />
+ ) : null}
+ </TableCell>
+ ))}
+ </TableRow>
+ ));
+}
+
+/** First-run body, pulled up over the ghost rows the table renders. */
+export function DataTableEmpty({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="data-table-empty"
+ className={cn(
+ "relative -mt-(--ghost-height)",
+ // overlay fading the ghost rows out towards the content
+ "before:via-background before:to-background before:absolute before:inset-x-0 before:top-0 before:h-(--ghost-height) before:bg-gradient-to-b before:from-transparent before:via-70%",
+ className,
+ )}
+ style={{ "--ghost-height": GHOST_HEIGHT } as React.CSSProperties}
+ {...props}
+ >
+ <EmptyStateContainer plain className="relative py-14">
+ {children}
+ </EmptyStateContainer>
+ </div>
+ );
+}
+
+/** Rows exist but the filters match none of them. */
+export function DataTableEmptyFiltered<TData>({
+ table,
+}: {
+ table: Table<TData>;
+}) {
+ return (
+ <EmptyStateContainer inline plain className="px-4">
+ <EmptyStateMedia>
+ <Filter />
+ </EmptyStateMedia>
+ <EmptyStateTitle>No matches</EmptyStateTitle>
+ <EmptyStateDescription>
+ Nothing matches the current filters.
+ </EmptyStateDescription>
+ <EmptyStateActions>
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ onClick={() => {
+ table.resetColumnFilters();
+ table.resetGlobalFilter();
+ }}
+ >
+ Clear filters
+ </Button>
+ </EmptyStateActions>
+ </EmptyStateContainer>
+ );
+}
diff --git a/apps/dashboard/src/components/ui/data-table/data-table.tsx b/apps/dashboard/src/components/ui/data-table/data-table.tsx
index 715a365b5..849d1378c 100644
--- a/apps/dashboard/src/components/ui/data-table/data-table.tsx
+++ b/apps/dashboard/src/components/ui/data-table/data-table.tsx
@@ -1,5 +1,6 @@
"use client";
+import { Inbox } from "@openstatus/icons";
import {
Table,
TableBody,
@@ -28,7 +29,18 @@ import {
import * as React from "react";
import { Fragment } from "react";
+import {
+ EmptyStateDescription,
+ EmptyStateMedia,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
+
import type { DataTableActionBarProps } from "./data-table-action-bar";
+import {
+ DataTableEmpty,
+ DataTableEmptyFiltered,
+ DataTableGhostRows,
+} from "./data-table-empty";
import type { DataTablePaginationProps } from "./data-table-pagination";
import type { DataTableToolbarProps } from "./data-table-toobar";
@@ -39,6 +51,8 @@ export interface DataTableProps<TData, TValue> {
toolbarComponent?: React.ComponentType<DataTableToolbarProps<TData>>;
actionBar?: React.ComponentType<DataTableActionBarProps<TData>>;
paginationComponent?: React.ComponentType<DataTablePaginationProps<TData>>;
+ /** First-run body when `data` is empty, a `DataTableEmpty` so it covers the ghost rows; a filter mismatch has its own row. */
+ emptyState?: React.ReactNode;
onRowClick?: (row: Row<TData>) => void;
defaultSorting?: SortingState;
defaultColumnVisibility?: VisibilityState;
@@ -64,6 +78,7 @@ export function DataTable<TData, TValue>({
toolbarComponent,
actionBar,
paginationComponent,
+ emptyState,
onRowClick,
defaultSorting = [],
defaultColumnVisibility = {},
@@ -138,7 +153,7 @@ export function DataTable<TData, TValue>({
{toolbarComponent
? React.createElement(toolbarComponent, { table })
: null}
- <div className="bg-background overflow-hidden rounded-md border">
+ <div className="bg-background @container overflow-hidden rounded-md border">
<Table>
<TableHeader className="bg-muted/40">
{table.getHeaderGroups().map((headerGroup) => (
@@ -204,14 +219,36 @@ export function DataTable<TData, TValue>({
</Fragment>
))
) : (
- <TableRow>
- <TableCell
- colSpan={columns.length}
- className="h-24 text-center"
- >
- No results.
- </TableCell>
- </TableRow>
+ <>
+ {data.length === 0 ? (
+ <DataTableGhostRows table={table} />
+ ) : null}
+ <TableRow className="hover:bg-transparent">
+ <TableCell
+ colSpan={table.getVisibleLeafColumns().length}
+ className="p-0 whitespace-normal"
+ >
+ {/* the cell spans the scrollable table; pin to the visible width */}
+ <div className="sticky left-0 w-[100cqw]">
+ {data.length > 0 ? (
+ <DataTableEmptyFiltered table={table} />
+ ) : (
+ (emptyState ?? (
+ <DataTableEmpty>
+ <EmptyStateMedia>
+ <Inbox />
+ </EmptyStateMedia>
+ <EmptyStateTitle>Nothing here yet</EmptyStateTitle>
+ <EmptyStateDescription>
+ Entries show up here as soon as there are some.
+ </EmptyStateDescription>
+ </DataTableEmpty>
+ ))
+ )}
+ </div>
+ </TableCell>
+ </TableRow>
+ </>
)}
</TableBody>
{actionBar ? React.createElement(actionBar, { table }) : null}
diff --git a/apps/dashboard/src/data/metrics.client.test.ts b/apps/dashboard/src/data/metrics.client.test.ts
index b67291207..bb4c1c666 100644
--- a/apps/dashboard/src/data/metrics.client.test.ts
+++ b/apps/dashboard/src/data/metrics.client.test.ts
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import {
getMonitorListMetrics,
getRegionAxisMax,
+ hasMetricsData,
isPaidPeriod,
mapMetrics,
mapRegionMetrics,
@@ -55,6 +56,37 @@ describe("mapMetrics", () => {
});
});
+describe("hasMetricsData", () => {
+ function window(lastTimestamp: number | null) {
+ return {
+ p50Latency: 0,
+ p75Latency: 0,
+ p90Latency: 0,
+ p95Latency: 0,
+ p99Latency: 0,
+ count: 0,
+ success: 0,
+ degraded: 0,
+ error: 0,
+ lastTimestamp,
+ };
+ }
+
+ it("is false when only the previous window row exists", () => {
+ expect(hasMetricsData({ data: [window(null)] } as unknown as Metrics)).toBe(
+ false,
+ );
+ });
+
+ it("is true once the current window has a check", () => {
+ expect(
+ hasMetricsData({
+ data: [window(null), window(123)],
+ } as unknown as Metrics),
+ ).toBe(true);
+ });
+});
+
describe("mapRegionMetrics", () => {
function row(region: string, timestamp: number, p50: number, p99: number) {
return {
@@ -175,8 +207,8 @@ describe("getMonitorListMetrics", () => {
]);
});
- it("shows N/A without latency data", () => {
+ it("shows an em dash without latency data", () => {
const p95 = getMonitorListMetrics().find((m) => m.key === "p95");
- expect(p95?.value).toBe("N/A");
+ expect(p95?.value).toBe("—");
});
});
diff --git a/apps/dashboard/src/data/metrics.client.ts b/apps/dashboard/src/data/metrics.client.ts
index 99e413dce..c6075e65e 100644
--- a/apps/dashboard/src/data/metrics.client.ts
+++ b/apps/dashboard/src/data/metrics.client.ts
@@ -57,6 +57,12 @@ export function mapMetrics(metrics: RouterOutputs["tinybird"]["metrics"]) {
});
}
+/** The current row carries a lastTimestamp; the previous one never does. */
+/** Only the current-window row carries a lastTimestamp; the previous-window row never does. */
+export function hasMetricsData(metrics: RouterOutputs["tinybird"]["metrics"]) {
+ return (mapMetrics(metrics) ?? []).some((row) => !!row.lastTimestamp);
+}
+
export const metricsCards = {
uptime: {
label: "UPTIME",
@@ -284,16 +290,17 @@ export function getMonitorListMetrics(
value = monitors.filter((m) => m.active === false).length;
break;
case "p95":
- const p95 = data.sort((a, b) => b.p95Latency - a.p95Latency)[0]
+ const p95 = [...data].sort((a, b) => b.p95Latency - a.p95Latency)[0]
?.p95Latency;
- value = p95 ? formatMilliseconds(p95) : "N/A";
+ value = p95 != null ? formatMilliseconds(p95) : "—";
break;
}
return {
title: metricsGlobalCards[key].title,
key,
- value,
+ // a count of nothing is not a zero
+ value: monitors.length === 0 ? "—" : value,
variant: variantMap[key],
} as const;
}) as readonly MonitorListMetric[];
diff --git a/apps/dashboard/src/lib/react-table.d.ts b/apps/dashboard/src/lib/react-table.d.ts
index 6fd1ac4fb..f1ce3d3cc 100644
--- a/apps/dashboard/src/lib/react-table.d.ts
+++ b/apps/dashboard/src/lib/react-table.d.ts
@@ -11,6 +11,8 @@ declare module "@tanstack/react-table" {
cellClassName?: string;
label?: string;
kind?: string;
+ /** `false` leaves the cell blank in the first-run ghost rows */
+ ghost?: boolean;
}
interface FilterFns {
diff --git a/packages/icons/src/lucide/index.ts b/packages/icons/src/lucide/index.ts
index 11202d790..d50fdb6aa 100644
--- a/packages/icons/src/lucide/index.ts
+++ b/packages/icons/src/lucide/index.ts
@@ -83,6 +83,7 @@ export {
Bell as Notification,
BellOff as NotificationOff,
LayoutGrid as Overview,
+ Pause,
CircleDashed as Pending,
Play,
Plug,
diff --git a/packages/icons/src/nucleo/index.ts b/packages/icons/src/nucleo/index.ts
index dd2081716..f8d109b62 100644
--- a/packages/icons/src/nucleo/index.ts
+++ b/packages/icons/src/nucleo/index.ts
@@ -82,6 +82,7 @@ export { Next } from "./next";
export { Notification } from "./notification";
export { NotificationOff } from "./notification-off";
export { Overview } from "./overview";
+export { Pause } from "./pause";
export { Pending } from "./pending";
export { Play } from "./play";
export { Plug } from "./plug";
diff --git a/packages/icons/src/nucleo/pause.tsx b/packages/icons/src/nucleo/pause.tsx
new file mode 100644
index 000000000..be57e8d81
--- /dev/null
+++ b/packages/icons/src/nucleo/pause.tsx
@@ -0,0 +1,46 @@
+import { forwardRef } from "react";
+
+import type { IconProps } from "../types";
+
+// from nucleo-ui-outline-18 (MediaPause); 18px grid, so the 1.5 stroke renders as 2px at size 24
+export const Pause = forwardRef<SVGSVGElement, IconProps>(
+ ({ size = 24, strokeWidth = 1.5, ...props }, ref) => (
+ <svg
+ ref={ref}
+ xmlns="http://www.w3.org/2000/svg"
+ width={size}
+ height={size}
+ viewBox="0 0 18 18"
+ style={{ flexShrink: 0 }}
+ {...props}
+ >
+ <rect
+ x="2.75"
+ y="2.75"
+ width="4.5"
+ height="12.5"
+ rx="1.5"
+ ry="1.5"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth={strokeWidth}
+ ></rect>
+ <rect
+ x="10.75"
+ y="2.75"
+ width="4.5"
+ height="12.5"
+ rx="1.5"
+ ry="1.5"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth={strokeWidth}
+ ></rect>
+ </svg>
+ ),
+);
+Pause.displayName = "Pause";