Skip to content

Open-source status page, incident response and uptime monitoring

fix: dashboard monitor settings form (#2638)

Maximilian Kaske3c01986f6939
diff --git a/apps/dashboard/src/components/forms/monitor-tag/sheet.tsx b/apps/dashboard/src/components/forms/monitor-tag/sheet.tsx
index 3442c4992..c5e7b6478 100644
--- a/apps/dashboard/src/components/forms/monitor-tag/sheet.tsx
+++ b/apps/dashboard/src/components/forms/monitor-tag/sheet.tsx
@@ -49,7 +49,10 @@ export function FormSheetMonitorTag({
<FormCard className="flex-1 overflow-auto rounded-none border-none">
<FormCardContent>
<FormMonitorTag
- onSubmit={onSubmit}
+ onSubmit={async (values) => {
+ await onSubmit(values);
+ setOpen(false);
+ }}
defaultValues={defaultValues}
id="tags-form"
className="my-4"
diff --git a/apps/dashboard/src/components/forms/monitor/form-follow-redirect.tsx b/apps/dashboard/src/components/forms/monitor/form-follow-redirect.tsx
index 8c783e303..65baeb81c 100644
--- a/apps/dashboard/src/components/forms/monitor/form-follow-redirect.tsx
+++ b/apps/dashboard/src/components/forms/monitor/form-follow-redirect.tsx
@@ -108,7 +108,7 @@ export function FormFollowRedirect({
<FormCardFooterInfo>
Learn more about{" "}
<Link
- href="https://www.openstatus.dev/docs/monitoring/customization/follow-redirects/"
+ href="https://www.openstatus.dev/docs/reference/http-monitor/#follow-redirects"
rel="noreferrer"
target="_blank"
>
diff --git a/apps/dashboard/src/components/forms/monitor/form-general.tsx b/apps/dashboard/src/components/forms/monitor/form-general.tsx
index 519de499c..7ecbc4250 100644
--- a/apps/dashboard/src/components/forms/monitor/form-general.tsx
+++ b/apps/dashboard/src/components/forms/monitor/form-general.tsx
@@ -36,6 +36,7 @@ import {
AlertDialogTitle,
} from "@openstatus/ui/components/ui/alert-dialog";
import { Button } from "@openstatus/ui/components/ui/button";
+import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
import {
Form,
FormControl,
@@ -57,7 +58,6 @@ import {
SelectTrigger,
SelectValue,
} from "@openstatus/ui/components/ui/select";
-import { Switch } from "@openstatus/ui/components/ui/switch";
import { Textarea } from "@openstatus/ui/components/ui/textarea";
import {
Tooltip,
@@ -153,6 +153,9 @@ export function FormGeneral({
const [isPending, startTransition] = useTransition();
const watchType = form.watch("type");
const watchMethod = form.watch("method");
+ // Each type has its own reference page; only http and dns support assertions.
+ const referenceUrl = `https://www.openstatus.dev/docs/reference/${watchType ?? "http"}-monitor/`;
+ const hasAssertions = watchType === "http" || watchType === "dns";
useEffect(() => {
// NOTE: reset form when type changes
@@ -259,8 +262,7 @@ export function FormGeneral({
</FormControl>
<FormMessage />
<FormDescription>
- Internal name for your monitor. This will be used to
- identify the monitor in the dashboard.
+ Internal name to identify the monitor in the dashboard.
</FormDescription>
</FormItem>
)}
@@ -269,14 +271,18 @@ export function FormGeneral({
control={form.control}
name="active"
render={({ field }) => (
- <FormItem className="flex flex-row items-center">
- <FormLabel>Active</FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
+ <FormItem className="sm:pt-5.5">
+ {/* pt = label height + gap, so the checkbox sits on the input line */}
+ <div className="flex items-center gap-2 sm:h-9">
+ <FormControl>
+ <Checkbox
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ <FormLabel>Active</FormLabel>
+ </div>
+ <FormDescription>Uncheck to pause checks.</FormDescription>
</FormItem>
)}
/>
@@ -1131,21 +1137,22 @@ export function FormGeneral({
<FormCardFooter>
<FormCardFooterInfo>
Learn more about{" "}
- <Link
- href="https://www.openstatus.dev/docs/tutorial/how-to-create-monitor/"
- rel="noreferrer"
- target="_blank"
- >
+ <Link href={referenceUrl} rel="noreferrer" target="_blank">
Monitor Type
- </Link>{" "}
- and{" "}
- <Link
- href="https://www.openstatus.dev/docs/tutorial/how-to-create-monitor/"
- rel="noreferrer"
- target="_blank"
- >
- Assertions
</Link>
+ {hasAssertions && (
+ <>
+ {" "}
+ and{" "}
+ <Link
+ href={`${referenceUrl}#assertions`}
+ rel="noreferrer"
+ target="_blank"
+ >
+ Assertions
+ </Link>
+ </>
+ )}
. We test your endpoint before saving the monitor.
</FormCardFooterInfo>
<Button type="submit" disabled={isPending || disabled}>
diff --git a/apps/dashboard/src/components/forms/monitor/form-tags.tsx b/apps/dashboard/src/components/forms/monitor/form-tags.tsx
index 491bf8828..7140c677a 100644
--- a/apps/dashboard/src/components/forms/monitor/form-tags.tsx
+++ b/apps/dashboard/src/components/forms/monitor/form-tags.tsx
@@ -149,7 +149,7 @@ export function FormTags({
variant="outline"
role="combobox"
className={cn(
- "h-auto min-h-9 w-full justify-between",
+ "w-full justify-between",
!field.value?.length && "text-muted-foreground",
)}
>
@@ -251,9 +251,7 @@ export function FormTags({
})),
}}
>
- <Button variant="outline" size="sm">
- Edit Tags
- </Button>
+ <Button variant="outline">Edit Tags</Button>
</FormSheetMonitorTag>
</div>
</FormCardContent>
diff --git a/apps/web/src/content/docs.config.ts b/apps/web/src/content/docs.config.ts
index 7f55327ca..6d8a890e5 100644
--- a/apps/web/src/content/docs.config.ts
+++ b/apps/web/src/content/docs.config.ts
@@ -245,12 +245,12 @@ export const docsNav: DocsNavSection[] = [
{ slug: "reference/grpc-monitor", label: "gRPC Monitor Reference" },
{ slug: "reference/http-monitor", label: "HTTP Monitor Reference" },
{ slug: "reference/icmp-monitor", label: "ICMP Monitor Reference" },
- { slug: "reference/incident", label: "Incident Reference" },
{ slug: "reference/tcp-monitor", label: "TCP Monitor Reference" },
{
slug: "reference/notification",
label: "Notification Channels Reference",
},
+ { slug: "reference/incident", label: "Incident Reference" },
{ slug: "reference/location", label: "Location Reference" },
{
slug: "reference/private-location",
diff --git a/packages/ui/src/components/ui/form.tsx b/packages/ui/src/components/ui/form.tsx
index a5f88f4ba..f0023cdbb 100644
--- a/packages/ui/src/components/ui/form.tsx
+++ b/packages/ui/src/components/ui/form.tsx
@@ -79,7 +79,7 @@ function FormItem({ className, ...props }: React.ComponentProps<"div">) {
<FormItemContext.Provider value={{ id }}>
<div
data-slot="form-item"
- className={cn("grid gap-2", className)}
+ className={cn("grid content-start gap-2", className)}
{...props}
/>
</FormItemContext.Provider>