Skip to content

Open-source status page, incident response and uptime monitoring

chore: clean up monitor visibility (#1062)

Maximilian Kaskef38efd2d07c1
diff --git a/apps/server/src/v1/pages/schema.ts b/apps/server/src/v1/pages/schema.ts
index ca800b049..e2c0c5fae 100644
--- a/apps/server/src/v1/pages/schema.ts
+++ b/apps/server/src/v1/pages/schema.ts
@@ -68,6 +68,15 @@ export const PageSchema = z.object({
})
.optional()
.nullish(),
+ showMonitorValues: z
+ .boolean()
+ .openapi({
+ description:
+ "Displays the total and failed request numbers for each monitor",
+ example: true,
+ })
+ .optional()
+ .nullish(),
monitors: z
.array(z.number())
.openapi({
diff --git a/apps/web/public/assets/changelog/status-page-hide-request-numbers.png b/apps/web/public/assets/changelog/status-page-hide-request-numbers.png
deleted file mode 100644
index 8284026a9..000000000
Binary files a/apps/web/public/assets/changelog/status-page-hide-request-numbers.png and /dev/null differ
diff --git a/apps/web/public/assets/changelog/status-page-monitor-values-visibility.png b/apps/web/public/assets/changelog/status-page-monitor-values-visibility.png
new file mode 100644
index 000000000..378a38423
Binary files /dev/null and b/apps/web/public/assets/changelog/status-page-monitor-values-visibility.png differ
diff --git a/apps/web/src/app/(content)/features/_components/tracker-example.tsx b/apps/web/src/app/(content)/features/_components/tracker-example.tsx
new file mode 100644
index 000000000..08bf5fad2
--- /dev/null
+++ b/apps/web/src/app/(content)/features/_components/tracker-example.tsx
@@ -0,0 +1,38 @@
+"use client";
+
+import { Tracker } from "@/components/tracker/tracker";
+import { Checkbox } from "@openstatus/ui";
+import { useState } from "react";
+import { mockTrackerData } from "../mock";
+
+export function TrackerWithVisibilityToggle() {
+ const [visible, setVisible] = useState(true);
+ return (
+ <div className="flex flex-col gap-8 my-auto">
+ <div className="items-top flex space-x-2">
+ <Checkbox
+ id="visibility"
+ onCheckedChange={(e) => setVisible(!!e)}
+ checked={visible}
+ />
+ <div className="grid gap-1.5 leading-none">
+ <label
+ htmlFor="visibility"
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ >
+ Show values
+ </label>
+ <p className="text-sm text-muted-foreground">
+ Share the uptime and number of requests.
+ </p>
+ </div>
+ </div>
+ <Tracker
+ data={mockTrackerData}
+ name="OpenStatus"
+ description="Website Health"
+ showValues={visible}
+ />
+ </div>
+ );
+}
diff --git a/apps/web/src/app/(content)/features/status-page/page.tsx b/apps/web/src/app/(content)/features/status-page/page.tsx
index ada838f36..3af7a105a 100644
--- a/apps/web/src/app/(content)/features/status-page/page.tsx
+++ b/apps/web/src/app/(content)/features/status-page/page.tsx
@@ -8,7 +8,6 @@ import { SubscribeButton } from "@/app/status-page/[domain]/_components/subscrib
import { MaintenanceContainer } from "@/components/status-page/maintenance";
import { StatusCheck } from "@/components/status-page/status-check";
import { StatusReport } from "@/components/status-page/status-report";
-import { Tracker } from "@/components/tracker/tracker";
import { marketingProductPagesConfig } from "@/config/pages";
import { Button, InputWithAddons } from "@openstatus/ui";
import type { Metadata } from "next";
@@ -16,7 +15,8 @@ import Link from "next/link";
import { Banner } from "../_components/banner";
import { Hero } from "../_components/hero";
import { InteractiveFeature } from "../_components/interactive-feature";
-import { maintenanceData, mockTrackerData, statusReportData } from "../mock";
+import { TrackerWithVisibilityToggle } from "../_components/tracker-example";
+import { maintenanceData, statusReportData } from "../mock";
const { description, subtitle } = marketingProductPagesConfig[1];
@@ -61,15 +61,7 @@ export default function FeaturePage() {
iconText="Simple by default"
title="Status page."
subTitle="Connect your monitors and inform your users about the uptime."
- component={
- <div className="my-auto">
- <Tracker
- data={mockTrackerData}
- name="OpenStatus"
- description="Website Health"
- />
- </div>
- }
+ component={<TrackerWithVisibilityToggle />}
col={2}
position={"left"}
/>
diff --git a/apps/web/src/components/billing/pro-feature-badge.tsx b/apps/web/src/components/billing/pro-feature-badge.tsx
new file mode 100644
index 000000000..808ce0c6b
--- /dev/null
+++ b/apps/web/src/components/billing/pro-feature-badge.tsx
@@ -0,0 +1,17 @@
+import type { WorkspacePlan } from "@openstatus/db/src/schema";
+import { Badge } from "@openstatus/ui";
+import { upgradePlan } from "./utils";
+
+export function ProFeatureBadge({
+ plan,
+ minRequiredPlan,
+}: {
+ plan: WorkspacePlan;
+ minRequiredPlan: WorkspacePlan;
+}) {
+ const shouldUpgrade = upgradePlan(plan, minRequiredPlan);
+
+ if (!shouldUpgrade) return null;
+
+ return <Badge>{minRequiredPlan}</Badge>;
+}
diff --git a/apps/web/src/components/billing/pro-feature-hover-card.tsx b/apps/web/src/components/billing/pro-feature-hover-card.tsx
index cf3c8c2d7..36728d4e8 100644
--- a/apps/web/src/components/billing/pro-feature-hover-card.tsx
+++ b/apps/web/src/components/billing/pro-feature-hover-card.tsx
@@ -2,15 +2,16 @@
import { useState } from "react";
-import { workspacePlanHierarchy } from "@openstatus/db/src/schema";
import type { WorkspacePlan } from "@openstatus/db/src/schema/workspaces/validation";
-import { HoverCard, HoverCardContent, HoverCardTrigger } from "@openstatus/ui";
+import {
+ Badge,
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from "@openstatus/ui";
import { ArrowUpRight } from "lucide-react";
import Link from "next/link";
-
-function upgradePlan(current: WorkspacePlan, required: WorkspacePlan) {
- return workspacePlanHierarchy[current] < workspacePlanHierarchy[required];
-}
+import { upgradePlan } from "./utils";
// TBD: we could useParams() to access workspaceSlug
@@ -25,17 +26,18 @@ export function ProFeatureHoverCard({
minRequiredPlan: WorkspacePlan;
workspaceSlug: string;
}) {
- console.log({ workspaceSlug, plan, minRequiredPlan });
const [open, setOpen] = useState(false);
const shouldUpgrade = upgradePlan(plan, minRequiredPlan);
if (!shouldUpgrade) return children;
+ // TODO: add a <Badge /> component to display the plan name
+
return (
<HoverCard openDelay={0} open={open} onOpenChange={setOpen}>
<HoverCardTrigger
onClick={() => setOpen(true)}
- className="opacity-70 cursor-not-allowed"
+ className="opacity-70 cursor-not-allowed relative"
asChild
>
{children}
diff --git a/apps/web/src/components/billing/utils.ts b/apps/web/src/components/billing/utils.ts
new file mode 100644
index 000000000..5784872fb
--- /dev/null
+++ b/apps/web/src/components/billing/utils.ts
@@ -0,0 +1,6 @@
+import { workspacePlanHierarchy } from "@openstatus/db/src/schema";
+import type { WorkspacePlan } from "@openstatus/db/src/schema/workspaces/validation";
+
+export function upgradePlan(current: WorkspacePlan, required: WorkspacePlan) {
+ return workspacePlanHierarchy[current] < workspacePlanHierarchy[required];
+}
diff --git a/apps/web/src/components/forms/status-page/form.tsx b/apps/web/src/components/forms/status-page/form.tsx
index f9f3945f0..b85929767 100644
--- a/apps/web/src/components/forms/status-page/form.tsx
+++ b/apps/web/src/components/forms/status-page/form.tsx
@@ -188,7 +188,7 @@ export function StatusPageForm({
<SectionMonitor form={form} monitors={allMonitors} />
</TabsContent>
<TabsContent value="advanced">
- <SectionAdvanced form={form} />
+ <SectionAdvanced {...{ form }} />
</TabsContent>
<TabsContent value="visibility">
<SectionVisibility {...{ form, plan, workspaceSlug }} />
diff --git a/apps/web/src/components/forms/status-page/section-advanced.tsx b/apps/web/src/components/forms/status-page/section-advanced.tsx
index 2608690d0..b2dfc6c8b 100644
--- a/apps/web/src/components/forms/status-page/section-advanced.tsx
+++ b/apps/web/src/components/forms/status-page/section-advanced.tsx
@@ -163,8 +163,18 @@ export function SectionAdvanced({ form }: Props) {
/>
<div className="grid w-full gap-4 md:grid-rows-2 md:grid-cols-3 md:col-span-full">
<SectionHeader
- title="Bar Settings"
- description="You can display or hide the amount of scheduled request an entpoint gets per day."
+ title="Monitor Values Visibility"
+ description={
+ <>
+ Toggle the visibility of the values on the status page. Share your{" "}
+ <span className="font-medium text-foreground">uptime</span> and
+ the{" "}
+ <span className="font-medium text-foreground">
+ number of request
+ </span>{" "}
+ to your endpoint.
+ </>
+ }
className="md:col-span-2"
/>
<div className="group md:row-span-2 flex flex-col justify-center gap-1 border border-dashed rounded-md p-3">
@@ -197,10 +207,9 @@ export function SectionAdvanced({ form }: Props) {
/>
</FormControl>
<div className="space-y-1 leading-none">
- <FormLabel>Show number of request</FormLabel>
+ <FormLabel>Show values</FormLabel>
<FormDescription>
- Share the total and failed amount of scheduled request to your
- endpoint.
+ Share the numbers to your users.
</FormDescription>
</div>
</FormItem>
diff --git a/apps/web/src/components/marketing/pricing/pricing-table.tsx b/apps/web/src/components/marketing/pricing/pricing-table.tsx
index 985c6f01e..8e3e9fa2d 100644
--- a/apps/web/src/components/marketing/pricing/pricing-table.tsx
+++ b/apps/web/src/components/marketing/pricing/pricing-table.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Check } from "lucide-react";
+import { Check, Info } from "lucide-react";
import { useRouter } from "next/navigation";
import { Fragment } from "react";
@@ -22,6 +22,12 @@ import { pricingTableConfig } from "../../../config/pricing-table";
import { LoadingAnimation } from "@/components/loading-animation";
import { cn } from "@/lib/utils";
import { allPlans } from "@openstatus/db/src/schema/plan/config";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@openstatus/ui";
export function PricingTable({
plans = workspacePlans,
@@ -112,62 +118,78 @@ export function PricingTable({
{label}
</TableCell>
</TableRow>
- {features.map(({ label, value, badge, monthly }, _i) => {
- return (
- <TableRow key={key + label}>
- <TableCell className="gap-1">
- {label}{" "}
- {badge ? (
- <Badge variant="secondary">{badge}</Badge>
- ) : null}
- </TableCell>
- {selectedPlans.map((plan, _i) => {
- const limitValue =
- plan.limits[value as keyof typeof plan.limits];
- function renderContent() {
- if (typeof limitValue === "boolean") {
- if (limitValue) {
+ {features.map(
+ ({ label, value, badge, monthly, description }, _i) => {
+ return (
+ <TableRow key={key + label}>
+ <TableCell>
+ <div className="flex gap-2 items-center">
+ {label}
+ {badge ? (
+ <Badge variant="secondary">{badge}</Badge>
+ ) : null}
+ {description ? (
+ <TooltipProvider delayDuration={200}>
+ <Tooltip>
+ <TooltipTrigger className="ml-auto data-[state=closed]:text-muted-foreground">
+ <Info className="w-4 h-4" />
+ </TooltipTrigger>
+ <TooltipContent className="w-64">
+ {description}
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : null}
+ </div>
+ </TableCell>
+ {selectedPlans.map((plan, _i) => {
+ const limitValue =
+ plan.limits[value as keyof typeof plan.limits];
+ function renderContent() {
+ if (typeof limitValue === "boolean") {
+ if (limitValue) {
+ return (
+ <Check className="h-4 w-4 text-foreground" />
+ );
+ }
return (
- <Check className="h-4 w-4 text-foreground" />
+ <span className="text-muted-foreground/50">
+ &#8208;
+ </span>
);
}
- return (
- <span className="text-muted-foreground/50">
- &#8208;
- </span>
- );
- }
- if (typeof limitValue === "number") {
- return new Intl.NumberFormat("us")
- .format(limitValue)
- .toString();
- }
- if (
- Array.isArray(limitValue) &&
- limitValue.length > 0
- ) {
- return limitValue[0];
+ if (typeof limitValue === "number") {
+ return new Intl.NumberFormat("us")
+ .format(limitValue)
+ .toString();
+ }
+ if (
+ Array.isArray(limitValue) &&
+ limitValue.length > 0
+ ) {
+ return limitValue[0];
+ }
+ return limitValue;
}
- return limitValue;
- }
- return (
- <TableCell
- // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
- key={key + value + _i}
- className={cn(
- "p-3 font-mono",
- plan.key === "team" && "bg-muted/30",
- )}
- >
- {renderContent()}
- {monthly ? "/mo" : ""}
- </TableCell>
- );
- })}
- </TableRow>
- );
- })}
+ return (
+ <TableCell
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
+ key={key + value + _i}
+ className={cn(
+ "p-3 font-mono",
+ plan.key === "team" && "bg-muted/30",
+ )}
+ >
+ {renderContent()}
+ {monthly ? "/mo" : ""}
+ </TableCell>
+ );
+ })}
+ </TableRow>
+ );
+ },
+ )}
</Fragment>
);
},
diff --git a/apps/web/src/components/tracker/tracker.tsx b/apps/web/src/components/tracker/tracker.tsx
index b948cdd1f..08f67933c 100644
--- a/apps/web/src/components/tracker/tracker.tsx
+++ b/apps/web/src/components/tracker/tracker.tsx
@@ -102,7 +102,7 @@ export function Tracker({
</TooltipProvider>
) : null}
</div>
- {!isMissing ? (
+ {!isMissing && showValues ? (
<p className="shrink-0 font-light text-muted-foreground">{uptime}%</p>
) : null}
</div>
diff --git a/apps/web/src/config/pricing-table.ts b/apps/web/src/config/pricing-table.tsx
similarity index 70%
rename from apps/web/src/config/pricing-table.ts
rename to apps/web/src/config/pricing-table.tsx
index 86bd11849..2bc3678dc 100644
--- a/apps/web/src/config/pricing-table.ts
+++ b/apps/web/src/config/pricing-table.tsx
@@ -1,4 +1,25 @@
import type { LimitsV1, LimitsV2 } from "@openstatus/db/src/schema/plan/schema";
+import Link from "next/link";
+import type React from "react";
+
+import { type Changelog, allChangelogs } from "contentlayer/generated";
+
+function renderChangelogDescription(slug: Changelog["slug"]) {
+ const changelog = allChangelogs.find((c) => c.slug === slug);
+ if (!changelog) return null;
+ return (
+ <span>
+ {changelog?.description}{" "}
+ <Link
+ href={`/changelog/${changelog.slug}`}
+ className="underline underline-offset-4 text-nowrap"
+ >
+ Learn more
+ </Link>
+ .
+ </span>
+ );
+}
export const pricingTableConfig: Record<
string,
@@ -7,6 +28,7 @@ export const pricingTableConfig: Record<
features: {
value: keyof LimitsV1 | keyof LimitsV2;
label: string;
+ description?: React.ReactNode; // tooltip informations
badge?: string;
monthly?: boolean;
}[];
@@ -54,6 +76,13 @@ export const pricingTableConfig: Record<
value: "maintenance",
label: "Maintenance status",
},
+ {
+ value: "monitor-values-visibility",
+ label: "Toggle numbers visibility",
+ description: renderChangelogDescription(
+ "status-page-monitor-values-visibility",
+ ),
+ },
{
value: "status-subscribers",
label: "Subscribers",
@@ -65,6 +94,9 @@ export const pricingTableConfig: Record<
{
value: "password-protection",
label: "Password-protected",
+ description: renderChangelogDescription(
+ "password-protected-status-page",
+ ),
},
{
value: "white-label",
diff --git a/apps/web/src/content/changelog/status-page-hide-request-numbers.mdx b/apps/web/src/content/changelog/status-page-hide-request-numbers.mdx
deleted file mode 100644
index f0351a516..000000000
--- a/apps/web/src/content/changelog/status-page-hide-request-numbers.mdx
+++ /dev/null
@@ -1,10 +0,0 @@
----
-title: Toggle monitor request numbers
-description: Show or hide the total and failed requests on a status page.
-publishedAt: 2024-10-20
-image: /assets/changelog/status-page-hide-request-numbers.png
----
-
-You can now hide your request numbers.
-
-We have added a checkbox within your Status Page settings to hide/show the number of total and failed requests for each monitor connected to the page.
\ No newline at end of file
diff --git a/apps/web/src/content/changelog/status-page-monitor-values-visibility.mdx b/apps/web/src/content/changelog/status-page-monitor-values-visibility.mdx
new file mode 100644
index 000000000..a7a62e054
--- /dev/null
+++ b/apps/web/src/content/changelog/status-page-monitor-values-visibility.mdx
@@ -0,0 +1,11 @@
+---
+title: Monitor values visibility
+description: Hide the uptime and number of request on your status pages.
+publishedAt: 2024-10-20
+image: /assets/changelog/status-page-monitor-values-visibility.png
+---
+
+
+You can now hide your request values.
+
+We have added a checkbox within your Status Page settings to hide/show the number of total and failed requests incl. the average percentage for each monitor connected to the page.
\ No newline at end of file
diff --git a/packages/db/src/schema/plan/config.ts b/packages/db/src/schema/plan/config.ts
index 365c5c4da..3e42b1a2e 100644
--- a/packages/db/src/schema/plan/config.ts
+++ b/packages/db/src/schema/plan/config.ts
@@ -24,6 +24,7 @@ export const allPlans: Record<
"data-retention": "14 days",
"status-pages": 1,
maintenance: true,
+ "monitor-values-visibility": true,
"status-subscribers": false,
"custom-domain": false,
"password-protection": false,
@@ -51,6 +52,7 @@ export const allPlans: Record<
"data-retention": "3 months",
"status-pages": 1,
maintenance: true,
+ "monitor-values-visibility": true,
"status-subscribers": true,
"custom-domain": true,
"password-protection": true,
@@ -114,6 +116,7 @@ export const allPlans: Record<
"data-retention": "12 months",
"status-pages": 5,
maintenance: true,
+ "monitor-values-visibility": true,
"status-subscribers": true,
"custom-domain": true,
"password-protection": true,
@@ -177,6 +180,7 @@ export const allPlans: Record<
"data-retention": "24 months",
"status-pages": 20,
maintenance: true,
+ "monitor-values-visibility": true,
"status-subscribers": true,
"custom-domain": true,
"password-protection": true,
diff --git a/packages/db/src/schema/plan/schema.ts b/packages/db/src/schema/plan/schema.ts
index f14407d9f..7ebd05a1f 100644
--- a/packages/db/src/schema/plan/schema.ts
+++ b/packages/db/src/schema/plan/schema.ts
@@ -33,6 +33,7 @@ export type LimitsV1 = z.infer<typeof limitsV1>;
export const limitsV2 = limitsV1.extend({
version: z.literal("v2"),
"private-locations": z.boolean(),
+ "monitor-values-visibility": z.boolean(),
});
export type LimitsV2 = z.infer<typeof limitsV2>;
@@ -44,6 +45,7 @@ export function migrateFromV1ToV2({ data }: { data: LimitsV1 }) {
version: "v2",
...data,
"private-locations": true,
+ "monitor-values-visibility": true,
};
}