Skip to content

Open-source status page, incident response and uptime monitoring

feat: monitor tags (#721)

Maximilian Kaske877a17096d7c
diff --git a/apps/web/public/assets/changelog/monitor-tags.png b/apps/web/public/assets/changelog/monitor-tags.png
new file mode 100644
index 000000000..4be0d7089
Binary files /dev/null and b/apps/web/public/assets/changelog/monitor-tags.png differ
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/loading.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/loading.tsx
index ae51d6a5b..50c068b87 100644
--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/loading.tsx
+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/loading.tsx
@@ -1,5 +1,11 @@
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton";
+import { DataTableToolbarSkeleton } from "@/components/data-table/data-table-toolbar-skeleton";
export default function Loading() {
- return <DataTableSkeleton />;
+ return (
+ <div className="space-y-4">
+ <DataTableToolbarSkeleton />
+ <DataTableSkeleton />
+ </div>
+ );
}
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
index d3da724f5..5f5df9603 100644
--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
@@ -34,6 +34,7 @@ export default async function MonitorPage() {
);
const _incidents = await api.incident.getIncidentsByWorkspace.query();
+ const tags = await api.monitorTag.getMonitorTagsByWorkspace.query();
// maybe not very efficient?
// use Suspense and Client call instead?
@@ -57,7 +58,11 @@ export default async function MonitorPage() {
(incident) => incident.monitorId === monitor.id,
);
- return { monitor, metrics: current, data, incidents };
+ const tags = monitor.monitorTagsToMonitors.map(
+ ({ monitorTag }) => monitorTag,
+ );
+
+ return { monitor, metrics: current, data, incidents, tags };
}),
);
@@ -69,7 +74,7 @@ export default async function MonitorPage() {
return (
<>
- <DataTable columns={columns} data={monitorsWithData} />
+ <DataTable columns={columns} data={monitorsWithData} tags={tags} />
{isLimitReached ? <Limit /> : null}
{/* <RefreshWidget defaultValue={lastCronTimestamp} /> */}
</>
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/edit/page.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/edit/page.tsx
index b3e2a5360..e468aadd0 100644
--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/edit/page.tsx
+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/edit/page.tsx
@@ -26,6 +26,8 @@ export default async function EditPage({
const pages = await api.page.getPagesByWorkspace.query();
+ const tags = await api.monitorTag.getMonitorTagsByWorkspace.query();
+
// default is request
const search = searchParamsSchema.safeParse(searchParams);
@@ -40,9 +42,15 @@ export default async function EditPage({
)
.map(({ id }) => id),
notifications: monitorNotifications?.map(({ id }) => id),
+ tags: tags
+ .filter((tag) =>
+ tag.monitor.map(({ monitorId }) => monitorId).includes(id),
+ )
+ .map(({ id }) => id),
}}
plan={workspace?.plan}
notifications={notifications}
+ tags={tags}
pages={pages}
/>
);
diff --git a/apps/web/src/components/data-table/data-table-faceted-filter.tsx b/apps/web/src/components/data-table/data-table-faceted-filter.tsx
index ae5673255..e165ea19d 100644
--- a/apps/web/src/components/data-table/data-table-faceted-filter.tsx
+++ b/apps/web/src/components/data-table/data-table-faceted-filter.tsx
@@ -118,11 +118,11 @@ export function DataTableFacetedFilter<TData, TValue>({
<option.icon className="text-muted-foreground mr-2 h-4 w-4" />
)}
<span>{option.label}</span>
- {facets?.get(option.value) && (
+ {facets?.get(option.value) ? (
<span className="ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs">
{facets.get(option.value)}
</span>
- )}
+ ) : null}
</CommandItem>
);
})}
diff --git a/apps/web/src/components/data-table/data-table-toolbar-skeleton.tsx b/apps/web/src/components/data-table/data-table-toolbar-skeleton.tsx
new file mode 100644
index 000000000..8dc2e584a
--- /dev/null
+++ b/apps/web/src/components/data-table/data-table-toolbar-skeleton.tsx
@@ -0,0 +1,11 @@
+import { Skeleton } from "@openstatus/ui";
+
+export function DataTableToolbarSkeleton() {
+ return (
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="flex flex-1 items-center gap-2">
+ <Skeleton className="h-8 w-[150px] lg:w-[250px]" />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/data-table/monitor/columns.tsx b/apps/web/src/components/data-table/monitor/columns.tsx
index ee507adc0..9f76b377d 100644
--- a/apps/web/src/components/data-table/monitor/columns.tsx
+++ b/apps/web/src/components/data-table/monitor/columns.tsx
@@ -4,13 +4,14 @@ import Link from "next/link";
import type { ColumnDef } from "@tanstack/react-table";
import { formatDistanceToNowStrict } from "date-fns";
-import type { Incident, Monitor } from "@openstatus/db/src/schema";
+import type { Incident, Monitor, MonitorTag } from "@openstatus/db/src/schema";
import type {
Monitor as MonitorTracker,
ResponseTimeMetrics,
} from "@openstatus/tinybird";
import { Tracker } from "@openstatus/tracker";
import {
+ Badge,
Tooltip,
TooltipContent,
TooltipProvider,
@@ -18,6 +19,7 @@ import {
} from "@openstatus/ui";
import { StatusDotWithTooltip } from "@/components/monitor/status-dot-with-tooltip";
+import { TagBadge } from "@/components/monitor/tag-badge";
import { Bar } from "@/components/tracker/tracker";
import { DataTableRowActions } from "./data-table-row-actions";
@@ -26,9 +28,11 @@ export const columns: ColumnDef<{
metrics?: ResponseTimeMetrics;
data?: MonitorTracker[];
incidents?: Incident[];
+ tags?: MonitorTag[];
}>[] = [
{
accessorKey: "name",
+ accessorFn: (row) => row.monitor.name, // used for filtering as name is nested within the monitor object
header: "Name",
cell: ({ row }) => {
const { active, status, name } = row.original.monitor;
@@ -43,6 +47,29 @@ export const columns: ColumnDef<{
);
},
},
+ {
+ accessorKey: "tags",
+ header: "Tags",
+ cell: ({ row }) => {
+ const { tags } = row.original;
+ const [first, second, ...rest] = tags || [];
+ return (
+ <div className="flex gap-2">
+ {first ? <TagBadge {...first} /> : null}
+ {second ? <TagBadge {...second} /> : null}
+ {rest.length > 0 ? <TagsTooltip tags={rest || []} /> : null}
+ </div>
+ );
+ },
+ filterFn: (row, id, value) => {
+ if (!Array.isArray(value)) return true;
+ // REMINDER: if one value is found, return true
+ // we could consider restricting it to all the values have to be found
+ return value.some(
+ (item) => row.original.tags?.some((tag) => tag.name === item),
+ );
+ },
+ },
{
accessorKey: "tracker",
header: () => (
@@ -127,6 +154,23 @@ export const columns: ColumnDef<{
},
];
+function TagsTooltip({ tags }: { tags: MonitorTag[] }) {
+ return (
+ <TooltipProvider>
+ <Tooltip delayDuration={200}>
+ <TooltipTrigger>
+ <Badge variant="secondary">+{tags.length}</Badge>
+ </TooltipTrigger>
+ <TooltipContent side="top" className="flex gap-2">
+ {tags.map((tag) => (
+ <TagBadge key={tag.id} {...tag} />
+ ))}
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+}
+
function HeaderTooltip({ label, content }: { label: string; content: string }) {
return (
<TooltipProvider>
diff --git a/apps/web/src/components/data-table/monitor/data-table-row-actions.tsx b/apps/web/src/components/data-table/monitor/data-table-row-actions.tsx
index e8f7be172..8e7d7cc25 100644
--- a/apps/web/src/components/data-table/monitor/data-table-row-actions.tsx
+++ b/apps/web/src/components/data-table/monitor/data-table-row-actions.tsx
@@ -64,9 +64,8 @@ export function DataTableRowActions<TData>({
try {
const { jobType, ...rest } = monitor;
if (!monitor.id) return;
- await api.monitor.update.mutate({
- ...rest,
- active: !monitor.active,
+ await api.monitor.toggleMonitorActive.mutate({
+ id: monitor.id,
});
toastAction("success");
router.refresh();
diff --git a/apps/web/src/components/data-table/monitor/data-table-toolbar.tsx b/apps/web/src/components/data-table/monitor/data-table-toolbar.tsx
new file mode 100644
index 000000000..5dfccbda5
--- /dev/null
+++ b/apps/web/src/components/data-table/monitor/data-table-toolbar.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import type { Table } from "@tanstack/react-table";
+import { X } from "lucide-react";
+
+import type { MonitorTag } from "@openstatus/db/src/schema";
+import { Button, Input } from "@openstatus/ui";
+
+import { DataTableFacetedFilter } from "../data-table-faceted-filter";
+
+interface DataTableToolbarProps<TData> {
+ table: Table<TData>;
+ tags?: MonitorTag[];
+}
+
+export function DataTableToolbar<TData>({
+ table,
+ tags,
+}: DataTableToolbarProps<TData>) {
+ const isFiltered = table.getState().columnFilters.length > 0;
+
+ return (
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="flex flex-1 items-center gap-2">
+ <Input
+ placeholder="Filter names..."
+ value={(table.getColumn("name")?.getFilterValue() as string) ?? ""}
+ onChange={(event) =>
+ table.getColumn("name")?.setFilterValue(event.target.value)
+ }
+ className="h-8 w-[150px] lg:w-[250px]"
+ />
+ {table.getColumn("tags") && tags && (
+ <DataTableFacetedFilter
+ column={table.getColumn("tags")}
+ title="Tags"
+ options={tags?.map((tag) => ({
+ label: tag.name,
+ value: tag.name,
+ }))}
+ />
+ )}
+ {isFiltered && (
+ <Button
+ variant="ghost"
+ onClick={() => table.resetColumnFilters()}
+ className="h-8 px-2 lg:px-3"
+ >
+ Reset
+ <X className="ml-2 h-4 w-4" />
+ </Button>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/data-table/monitor/data-table.tsx b/apps/web/src/components/data-table/monitor/data-table.tsx
index fbfabd020..c7902073e 100644
--- a/apps/web/src/components/data-table/monitor/data-table.tsx
+++ b/apps/web/src/components/data-table/monitor/data-table.tsx
@@ -1,13 +1,22 @@
"use client";
import * as React from "react";
-import type { ColumnDef } from "@tanstack/react-table";
+import type {
+ ColumnDef,
+ ColumnFiltersState,
+ Table as TTable,
+} from "@tanstack/react-table";
import {
flexRender,
getCoreRowModel,
+ getFacetedRowModel,
+ getFilteredRowModel,
useReactTable,
} from "@tanstack/react-table";
+import { z } from "zod";
+import { selectMonitorTagSchema } from "@openstatus/db/src/schema";
+import type { MonitorTag } from "@openstatus/db/src/schema";
import {
Table,
TableBody,
@@ -17,68 +26,107 @@ import {
TableRow,
} from "@openstatus/ui";
+import { DataTableToolbar } from "./data-table-toolbar";
+
interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[];
data: TData[];
+ tags?: MonitorTag[];
}
-// FIXME: right now, the mobile layout is messed up
-// https://github.com/TanStack/table/discussions/3192#discussioncomment-6458134
-
export function DataTable<TData, TValue>({
columns,
data,
+ tags,
}: DataTableProps<TData, TValue>) {
+ const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
+ [],
+ );
const table = useReactTable({
data,
columns,
+ state: {
+ columnFilters,
+ },
+ onColumnFiltersChange: setColumnFilters,
+ getFilteredRowModel: getFilteredRowModel(),
getCoreRowModel: getCoreRowModel(),
+ getFacetedRowModel: getFacetedRowModel(),
+ // getFacetedUniqueValues: getFacetedUniqueValues(),
+ // REMINDER: We cannot use the default getFacetedUniqueValues as it doesnt support Array of Objects
+ getFacetedUniqueValues: (table: TTable<TData>, columnId: string) => () => {
+ const map = new Map();
+ if (columnId === "tags") {
+ tags?.forEach((tag) => {
+ const tagsNumber = data.reduce((prev, curr) => {
+ const values = z
+ .object({ tags: z.array(selectMonitorTagSchema) })
+ .safeParse(curr);
+ if (!values.success) return prev;
+ if (values.data.tags?.find((t) => t.name === tag.name))
+ return prev + 1;
+ return prev;
+ }, 0);
+ map.set(tag.name, tagsNumber);
+ });
+ }
+ return map;
+ },
});
return (
- <div className="rounded-md border">
- <Table>
- <TableHeader className="bg-muted/50">
- {table.getHeaderGroups().map((headerGroup) => (
- <TableRow key={headerGroup.id} className="hover:bg-transparent">
- {headerGroup.headers.map((header) => {
- return (
- <TableHead key={header.id}>
- {header.isPlaceholder
- ? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext(),
- )}
- </TableHead>
- );
- })}
- </TableRow>
- ))}
- </TableHeader>
- <TableBody>
- {table.getRowModel().rows?.length ? (
- table.getRowModel().rows.map((row) => (
- <TableRow
- key={row.id}
- data-state={row.getIsSelected() && "selected"}
- >
- {row.getVisibleCells().map((cell) => (
- <TableCell key={cell.id}>
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- </TableCell>
- ))}
+ <div className="space-y-4">
+ <DataTableToolbar table={table} tags={tags} />
+ <div className="rounded-md border">
+ <Table>
+ <TableHeader className="bg-muted/50">
+ {table.getHeaderGroups().map((headerGroup) => (
+ <TableRow key={headerGroup.id} className="hover:bg-transparent">
+ {headerGroup.headers.map((header) => {
+ return (
+ <TableHead key={header.id}>
+ {header.isPlaceholder
+ ? null
+ : flexRender(
+ header.column.columnDef.header,
+ header.getContext(),
+ )}
+ </TableHead>
+ );
+ })}
+ </TableRow>
+ ))}
+ </TableHeader>
+ <TableBody>
+ {table.getRowModel().rows?.length ? (
+ table.getRowModel().rows.map((row) => (
+ <TableRow
+ key={row.id}
+ data-state={row.getIsSelected() && "selected"}
+ >
+ {row.getVisibleCells().map((cell) => (
+ <TableCell key={cell.id}>
+ {flexRender(
+ cell.column.columnDef.cell,
+ cell.getContext(),
+ )}
+ </TableCell>
+ ))}
+ </TableRow>
+ ))
+ ) : (
+ <TableRow>
+ <TableCell
+ colSpan={columns.length}
+ className="h-24 text-center"
+ >
+ No results.
+ </TableCell>
</TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={columns.length} className="h-24 text-center">
- No results.
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ )}
+ </TableBody>
+ </Table>
+ </div>
</div>
);
}
diff --git a/apps/web/src/components/forms/monitor-tag/form.tsx b/apps/web/src/components/forms/monitor-tag/form.tsx
new file mode 100644
index 000000000..7a67fb93d
--- /dev/null
+++ b/apps/web/src/components/forms/monitor-tag/form.tsx
@@ -0,0 +1,97 @@
+"use client";
+
+import * as React from "react";
+import { useRouter } from "next/navigation";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useForm } from "react-hook-form";
+
+import { insertMonitorTagSchema } from "@openstatus/db/src/schema";
+import type { InsertMonitorTag, MonitorTag } from "@openstatus/db/src/schema";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+ Input,
+} from "@openstatus/ui";
+
+import { toastAction } from "@/lib/toast";
+import { api } from "@/trpc/client";
+import { SaveButton } from "../shared/save-button";
+
+interface Props {
+ defaultValues?: MonitorTag;
+}
+
+export function MonitorTagForm({ defaultValues }: Props) {
+ const form = useForm<InsertMonitorTag>({
+ resolver: zodResolver(insertMonitorTagSchema),
+ defaultValues,
+ });
+ const router = useRouter();
+ const [isPending, startTransition] = React.useTransition();
+
+ const onSubmit = ({ ...props }: InsertMonitorTag) => {
+ startTransition(async () => {
+ try {
+ if (defaultValues) {
+ await api.monitorTag.update.mutate({ ...props });
+ } else {
+ await api.monitorTag.create.mutate({ ...props });
+ }
+ router.refresh();
+ toastAction("saved");
+ } catch {
+ toastAction("error");
+ }
+ });
+ };
+
+ return (
+ <Form {...form}>
+ <form
+ onSubmit={async (e) => {
+ e.preventDefault();
+ form.handleSubmit(onSubmit)(e);
+ }}
+ className="grid w-full gap-6"
+ >
+ <div className="flex gap-6">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input placeholder="API" {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="color"
+ render={({ field }) => (
+ <FormItem className="w-12">
+ <FormLabel>Color</FormLabel>
+ <FormControl>
+ <Input type="color" {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ <SaveButton
+ isPending={isPending}
+ isDirty={form.formState.isDirty}
+ onSubmit={form.handleSubmit(onSubmit)}
+ />
+ </form>
+ </Form>
+ );
+}
diff --git a/apps/web/src/components/forms/monitor/form.tsx b/apps/web/src/components/forms/monitor/form.tsx
index d8a3821a9..fe70f7a5c 100644
--- a/apps/web/src/components/forms/monitor/form.tsx
+++ b/apps/web/src/components/forms/monitor/form.tsx
@@ -8,6 +8,7 @@ import { useForm } from "react-hook-form";
import type {
InsertMonitor,
MonitorFlyRegion,
+ MonitorTag,
Notification,
Page,
WorkspacePlan,
@@ -39,6 +40,7 @@ interface Props {
defaultValues?: InsertMonitor;
plan?: WorkspacePlan;
notifications?: Notification[];
+ tags?: MonitorTag[];
pages?: Page[];
nextUrl?: string;
}
@@ -49,6 +51,7 @@ export function MonitorForm({
plan = "free",
notifications,
pages,
+ tags,
nextUrl,
}: Props) {
const form = useForm<InsertMonitor>({
@@ -69,6 +72,7 @@ export function MonitorForm({
method: defaultValues?.method ?? "GET",
notifications: defaultValues?.notifications ?? [],
pages: defaultValues?.pages ?? [],
+ tags: defaultValues?.tags ?? [],
},
});
const router = useRouter();
@@ -98,12 +102,12 @@ export function MonitorForm({
const onSubmit = ({ ...props }: InsertMonitor) => {
startTransition(async () => {
try {
- const pingResult = await pingEndpoint();
- const isOk = pingResult?.status >= 200 && pingResult?.status < 300;
- if (!isOk) {
- setPingFailed(true);
- return;
- }
+ // const pingResult = await pingEndpoint();
+ // const isOk = pingResult?.status >= 200 && pingResult?.status < 300;
+ // if (!isOk) {
+ // setPingFailed(true);
+ // return;
+ // }
await handleDataUpdateOrInsertion(props);
} catch {
toastAction("error");
@@ -140,7 +144,7 @@ export function MonitorForm({
onKeyDown={(e) => e.key === "Enter" && e.preventDefault()}
className="flex w-full flex-col gap-6"
>
- <General {...{ form, plan }} />
+ <General {...{ form, plan, tags }} />
<Tabs
defaultValue={defaultSection}
className="w-full"
diff --git a/apps/web/src/components/forms/monitor/general.tsx b/apps/web/src/components/forms/monitor/general.tsx
index 6cf7a7522..19d49937d 100644
--- a/apps/web/src/components/forms/monitor/general.tsx
+++ b/apps/web/src/components/forms/monitor/general.tsx
@@ -3,7 +3,11 @@
import * as React from "react";
import type { UseFormReturn } from "react-hook-form";
-import type { InsertMonitor, WorkspacePlan } from "@openstatus/db/src/schema";
+import type {
+ InsertMonitor,
+ MonitorTag,
+ WorkspacePlan,
+} from "@openstatus/db/src/schema";
import {
FormControl,
FormDescription,
@@ -15,53 +19,81 @@ import {
Switch,
} from "@openstatus/ui";
+import { TagBadge } from "@/components/monitor/tag-badge";
import { SectionHeader } from "../shared/section-header";
+import { TagsMultiBox } from "./tags-multi-box";
interface Props {
form: UseFormReturn<InsertMonitor>;
plan: WorkspacePlan;
+ tags?: MonitorTag[];
}
-export function General({ form }: Props) {
+export function General({ form, tags }: Props) {
+ const watchTags = form.watch("tags");
return (
<div className="grid gap-4 sm:grid-cols-3 sm:gap-6">
<SectionHeader
title="Basic Information"
description="Be able to find your monitor easily."
/>
- <div className="flex w-full gap-4 sm:col-span-2">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem className="w-full">
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input placeholder="Documenso" {...field} />
- </FormControl>
- <FormDescription>Displayed on the status page.</FormDescription>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="active"
- render={({ field }) => (
- <FormItem className="flex flex-row items-center justify-between space-x-1 space-y-0">
- <FormLabel>Active</FormLabel>
- <FormControl>
- <Switch
- checked={field.value || false}
- onCheckedChange={(value) => field.onChange(value)}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ <div className="flex w-full flex-col gap-4 sm:col-span-2">
+ <div className="flex w-full gap-4">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem className="w-full">
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input placeholder="Documenso" {...field} />
+ </FormControl>
+ <FormDescription>Displayed on the status page.</FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="active"
+ render={({ field }) => (
+ <FormItem className="flex flex-row items-center justify-between space-x-1 space-y-0">
+ <FormLabel>Active</FormLabel>
+ <FormControl>
+ <Switch
+ checked={field.value || false}
+ onCheckedChange={(value) => field.onChange(value)}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ <div className="grid gap-4 sm:grid-cols-3">
+ <FormField
+ control={form.control}
+ name="tags"
+ render={({ field }) => (
+ <FormItem className="sm:col-span-2">
+ <FormLabel>Tags</FormLabel>
+ <FormControl>
+ <TagsMultiBox
+ tags={tags}
+ onChange={field.onChange}
+ values={field.value}
+ // {...field}
+ />
+ </FormControl>
+ <FormDescription>
+ Easily categorize your monitors.
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
</div>
- {/* TODO: add FancyBox with "Create Tag option" once `monitor_tabs` db table is set up */}
</div>
);
}
diff --git a/apps/web/src/components/forms/monitor/tags-multi-box.tsx b/apps/web/src/components/forms/monitor/tags-multi-box.tsx
new file mode 100644
index 000000000..dca5c52d0
--- /dev/null
+++ b/apps/web/src/components/forms/monitor/tags-multi-box.tsx
@@ -0,0 +1,391 @@
+"use client";
+
+import * as React from "react";
+import { Check, ChevronsUpDown, Edit2 } from "lucide-react";
+
+import type { MonitorTag } from "@openstatus/db/src/schema";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+ Button,
+ Command,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandSeparator,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+ Input,
+ Label,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@openstatus/ui";
+
+import { Icons } from "@/components/icons";
+import { LoadingAnimation } from "@/components/loading-animation";
+import { TagBadge } from "@/components/monitor/tag-badge";
+import { toastAction } from "@/lib/toast";
+import { cn } from "@/lib/utils";
+import { api } from "@/trpc/client";
+
+const colors = [
+ "#ff5c5c", // Red
+ "#6fcf97", // Green
+ "#70a1ff", // Blue
+ "#ffb74d", // Orange
+ "#b19cd9", // Violet
+ "#7986cb", // Indigo
+ "#64b5f6", // Turquoise
+ "#ffee58", // Yellow
+ "#f06292", // Pink
+ "#ff77ff", // Fuchsia
+ "#808080", // Gray
+];
+
+interface TagsMultiBoxProps {
+ tags?: MonitorTag[];
+ values: number[]; // values from the form
+ onChange: (values: number[]) => void;
+}
+
+export function TagsMultiBox({
+ tags: defaultTags,
+ values,
+ onChange,
+}: TagsMultiBoxProps) {
+ const inputRef = React.useRef<HTMLInputElement>(null);
+ const [tags, setTags] = React.useState<MonitorTag[]>(defaultTags || []);
+ const [openCombobox, setOpenCombobox] = React.useState(false);
+ const [openDialog, setOpenDialog] = React.useState(false);
+ const [inputValue, setInputValue] = React.useState<string>("");
+
+ const create = async (name: string) => {
+ try {
+ const randomIndex = Math.floor(Math.random() * colors.length);
+ const newTag = await api.monitorTag.create.mutate({
+ name: name.trim(),
+ color: colors[randomIndex] || "#808080", // gray as default
+ });
+ toastAction("saved");
+ setTags((prev) => [...prev, newTag]);
+ // TODO: seems like the new value is not taken into account....
+ // That's mainly because we only update the id, and not the name! Same is for the update() function
+ onChange([...values, newTag.id]);
+ } catch {
+ toastAction("error");
+ }
+ };
+
+ const toggle = (item: MonitorTag) => {
+ onChange(
+ values?.includes(item.id)
+ ? values.filter((v) => v !== item.id)
+ : [...values, item.id],
+ );
+ inputRef?.current?.focus();
+ };
+
+ const update = async (tag: MonitorTag) => {
+ try {
+ const updateTag = await api.monitorTag.update.mutate(tag);
+ if (!updateTag) return;
+ setTags((prev) => prev.map((f) => (f.id === tag.id ? updateTag : f)));
+ toastAction("saved");
+ } catch {
+ toastAction("error");
+ }
+ };
+
+ const _delete = async (item: MonitorTag) => {
+ try {
+ await api.monitorTag.delete.mutate({ id: item.id });
+ setTags((prev) => prev.filter((f) => f.id !== item.id));
+ onChange(values?.filter((v) => v !== item.id));
+ toastAction("deleted");
+ } catch {
+ toastAction("error");
+ }
+ };
+
+ const onComboboxOpenChange = (value: boolean) => {
+ inputRef.current?.blur(); // HACK: otherwise, would scroll automatically to the bottom of page
+ setOpenCombobox(value);
+ };
+
+ return (
+ <div className="w-full">
+ <Popover open={openCombobox} onOpenChange={onComboboxOpenChange}>
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={openCombobox}
+ className="text-foreground h-auto w-full justify-between"
+ >
+ <span className="flex flex-wrap gap-2 truncate">
+ {values.length > 0
+ ? values.map((id) => {
+ const tag = tags.find((tag) => tag.id === id);
+ return tag ? <TagBadge key={tag.id} {...tag} /> : null;
+ })
+ : "Select tags"}
+ </span>
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-full p-0">
+ <Command className="w-[var(--radix-popover-trigger-width)]" loop>
+ <CommandInput
+ ref={inputRef}
+ placeholder="Search tag..."
+ value={inputValue}
+ onValueChange={setInputValue}
+ />
+ <CommandGroup className="max-h-[145px] overflow-auto">
+ {tags.map((item) => {
+ const isActive = values?.includes(item.id);
+ return (
+ <CommandItem
+ key={item.id}
+ value={item.name}
+ onSelect={() => toggle(item)}
+ >
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ isActive ? "opacity-100" : "opacity-0",
+ )}
+ />
+ <div className="flex-1">{item.name}</div>
+ <div
+ className="h-4 w-4 rounded-full"
+ style={{ backgroundColor: item.color }}
+ />
+ </CommandItem>
+ );
+ })}
+ <CommandItemCreate
+ onSelect={() => create(inputValue)}
+ {...{ inputValue, tags }}
+ />
+ </CommandGroup>
+ <CommandSeparator alwaysRender />
+ <CommandGroup>
+ <CommandItem
+ value={`:${inputValue}:`} // HACK: that way, the edit button will always be shown
+ className="text-muted-foreground text-xs"
+ onSelect={() => setOpenDialog(true)}
+ >
+ <div className={cn("mr-2 h-4 w-4")} />
+ <Edit2 className="mr-2 h-2.5 w-2.5" />
+ Edit tags
+ </CommandItem>
+ </CommandGroup>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ <Dialog
+ open={openDialog}
+ onOpenChange={(open) => {
+ if (!open) setOpenCombobox(true);
+ setOpenDialog(open);
+ }}
+ >
+ <DialogContent className="flex max-h-[90vh] flex-col">
+ <DialogHeader>
+ <DialogTitle>Edit Tags</DialogTitle>
+ <DialogDescription>
+ Update or delete tags. Create a tag through the combobox.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="flex-1 overflow-scroll">
+ {tags.map((item) => {
+ return (
+ <DialogListItem
+ key={item.id}
+ onDelete={() => _delete(item)}
+ onSubmit={async (values) => {
+ await update({
+ ...item,
+ ...values,
+ });
+ }}
+ {...item}
+ />
+ );
+ })}
+ </div>
+ </DialogContent>
+ </Dialog>
+ </div>
+ );
+}
+
+const CommandItemCreate = ({
+ inputValue,
+ tags,
+ onSelect,
+}: {
+ inputValue: string;
+ tags: MonitorTag[];
+ onSelect: () => Promise<void>;
+}) => {
+ const [isPending, startTransition] = React.useTransition();
+ const hasNoTag = !tags
+ .map(({ name }) => name.toLowerCase())
+ .includes(`${inputValue.toLowerCase()}`);
+
+ const render = inputValue !== "" && hasNoTag;
+
+ if (!render) return null;
+
+ // BUG: whenever a space is appended, the Create-Button will not be shown.
+ return (
+ <CommandItem
+ key={`${inputValue}`}
+ value={`${inputValue}`}
+ className="text-muted-foreground text-xs"
+ onSelect={() => {
+ startTransition(async () => {
+ await onSelect();
+ });
+ }}
+ disabled={isPending}
+ >
+ <div className={cn("mr-2 h-4 w-4")} />
+ {isPending ? "Creating" : "Create"} new label &quot;{inputValue}&quot;
+ </CommandItem>
+ );
+};
+
+const DialogListItem = ({
+ id,
+ name,
+ color,
+ onSubmit,
+ onDelete,
+}: MonitorTag & {
+ onSubmit: (values: { name: string; color: string }) => Promise<void>;
+ onDelete: () => Promise<void>;
+}) => {
+ const inputRef = React.useRef<HTMLInputElement>(null);
+ const [accordionValue, setAccordionValue] = React.useState<string>("");
+ const [inputValue, setInputValue] = React.useState<string>(name);
+ const [colorValue, setColorValue] = React.useState<string>(color);
+ const [isPending, startTransition] = React.useTransition();
+ const disabled = name === inputValue && color === colorValue;
+
+ React.useEffect(() => {
+ if (accordionValue !== "") {
+ inputRef.current?.focus();
+ }
+ }, [accordionValue]);
+
+ // const handleSubmit = () => {}
+ // const handleDelete = () => {}
+
+ return (
+ <Accordion
+ key={id}
+ type="single" // will never work as we have only one accordion for each tag
+ collapsible
+ value={accordionValue}
+ onValueChange={setAccordionValue}
+ >
+ <AccordionItem value={`item-${id}`}>
+ <AccordionTrigger className="w-full hover:no-underline">
+ <TagBadge color={color} name={name} />
+ </AccordionTrigger>
+ <AccordionContent>
+ {/* REMINDER: cannot nest form within form! HOTFIX: no form */}
+ <div className="flex items-end gap-4 px-1">
+ <div className="grid w-full gap-3">
+ <Label htmlFor="name">Label name</Label>
+ <Input
+ ref={inputRef}
+ id="name"
+ value={inputValue}
+ onChange={(e) => setInputValue(e.target.value)}
+ className="h-8"
+ />
+ </div>
+ <div className="grid gap-3">
+ <Label htmlFor="color">Color</Label>
+ <Input
+ id="color"
+ type="color"
+ value={colorValue}
+ onChange={(e) => setColorValue(e.target.value)}
+ className="h-8 px-2 py-1"
+ />
+ </div>
+ {/* FIXME: shouldnt saves the monitor form */}
+ <Button
+ onClick={() => {
+ startTransition(() => {
+ onSubmit({
+ name: inputValue.trim(),
+ color: colorValue,
+ });
+ setAccordionValue("");
+ });
+ }}
+ disabled={disabled || isPending}
+ >
+ {isPending ? <LoadingAnimation /> : "Save"}
+ </Button>
+ <div className="flex items-center gap-4">
+ <AlertDialog>
+ <AlertDialogTrigger asChild>
+ <Button
+ size="icon"
+ variant="destructive"
+ disabled={isPending}
+ >
+ <Icons.trash className="h-4 w-4" />
+ </Button>
+ </AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Are you sure sure?</AlertDialogTitle>
+ <AlertDialogDescription>
+ You are about to delete the tag{" "}
+ <TagBadge color={color} name={name} /> .
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={() => {
+ startTransition(async () => {
+ await onDelete();
+ });
+ }}
+ >
+ {isPending ? <LoadingAnimation /> : "Delete"}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </div>
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ );
+};
diff --git a/apps/web/src/components/monitor/tag-badge.tsx b/apps/web/src/components/monitor/tag-badge.tsx
new file mode 100644
index 000000000..b1cfac2e9
--- /dev/null
+++ b/apps/web/src/components/monitor/tag-badge.tsx
@@ -0,0 +1,18 @@
+import { Badge } from "@openstatus/ui";
+
+function getStyle(color: string) {
+ return {
+ borderColor: `${color}20`,
+ backgroundColor: `${color}30`,
+ color,
+ };
+}
+
+interface TagBadgeProps {
+ name: string;
+ color: string;
+}
+
+export function TagBadge({ color, name }: TagBadgeProps) {
+ return <Badge style={getStyle(color)}>{name}</Badge>;
+}
diff --git a/apps/web/src/content/changelog/monitor-tags.mdx b/apps/web/src/content/changelog/monitor-tags.mdx
new file mode 100644
index 000000000..58c4fb5fa
--- /dev/null
+++ b/apps/web/src/content/changelog/monitor-tags.mdx
@@ -0,0 +1,11 @@
+---
+title: Monitor Tags
+description: Easily categorize your monitors with tags.
+image: /assets/changelog/monitor-tags.png
+publishedAt: 2024-03-20
+---
+
+You can now create tags for your monitors to easily categorize them. Tags can be
+used to filter monitors on the dashboard and in the monitor list.
+
+Create, update or delete a tag via your monitor settings.
diff --git a/packages/api/src/edge.ts b/packages/api/src/edge.ts
index 2a8619cdd..329527f21 100644
--- a/packages/api/src/edge.ts
+++ b/packages/api/src/edge.ts
@@ -3,6 +3,7 @@ import { incidentRouter } from "./router/incident";
import { integrationRouter } from "./router/integration";
import { invitationRouter } from "./router/invitation";
import { monitorRouter } from "./router/monitor";
+import { monitorTagRouter } from "./router/monitorTag";
import { notificationRouter } from "./router/notification";
import { pageRouter } from "./router/page";
import { pageSubscriberRouter } from "./router/pageSubscriber";
@@ -26,4 +27,5 @@ export const edgeRouter = createTRPCRouter({
incident: incidentRouter,
pageSubscriber: pageSubscriberRouter,
tinybird: tinybirdRouter,
+ monitorTag: monitorTagRouter,
});
diff --git a/packages/api/src/router/monitor.ts b/packages/api/src/router/monitor.ts
index 09518b518..7e940c1f1 100644
--- a/packages/api/src/router/monitor.ts
+++ b/packages/api/src/router/monitor.ts
@@ -9,11 +9,14 @@ import {
monitorPeriodicitySchema,
monitorStatusTable,
monitorsToPages,
+ monitorTag,
+ monitorTagsToMonitors,
notification,
notificationsToMonitors,
page,
selectMonitorSchema,
selectMonitorStatusSchema,
+ selectMonitorTagSchema,
selectNotificationSchema,
} from "@openstatus/db/src/schema";
import { allPlans } from "@openstatus/plans";
@@ -56,7 +59,7 @@ export const monitorRouter = createTRPCRouter({
}
// FIXME: this is a hotfix
- const { regions, headers, notifications, id, pages, ...data } =
+ const { regions, headers, notifications, id, pages, tags, ...data } =
opts.input;
const newMonitor = await opts.ctx.db
@@ -73,9 +76,11 @@ export const monitorRouter = createTRPCRouter({
.get();
if (notifications.length > 0) {
- // We should make sure the user has access to the notifications
const allNotifications = await opts.ctx.db.query.notification.findMany({
- where: inArray(notification.id, notifications),
+ where: and(
+ eq(notification.workspaceId, opts.ctx.workspace.id),
+ inArray(notification.id, notifications),
+ ),
});
const values = allNotifications.map((notification) => ({
@@ -86,10 +91,28 @@ export const monitorRouter = createTRPCRouter({
await opts.ctx.db.insert(notificationsToMonitors).values(values).run();
}
+ if (tags.length > 0) {
+ const allTags = await opts.ctx.db.query.monitorTag.findMany({
+ where: and(
+ eq(monitorTag.workspaceId, opts.ctx.workspace.id),
+ inArray(monitorTag.id, tags),
+ ),
+ });
+
+ const values = allTags.map((monitorTag) => ({
+ monitorId: newMonitor.id,
+ monitorTagId: monitorTag.id,
+ }));
+
+ await opts.ctx.db.insert(monitorTagsToMonitors).values(values).run();
+ }
+
if (pages.length > 0) {
- // We should make sure the user has access to the notifications
const allPages = await opts.ctx.db.query.page.findMany({
- where: inArray(page.id, pages),
+ where: and(
+ eq(page.workspaceId, opts.ctx.workspace.id),
+ inArray(page.id, pages),
+ ),
});
const values = allPages.map((page) => ({
@@ -126,12 +149,13 @@ export const monitorRouter = createTRPCRouter({
const parsedMonitor = selectMonitorSchema.safeParse(currentMonitor);
if (!parsedMonitor.success) {
+ console.log(parsedMonitor.error);
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not allowed to access the monitor.",
});
}
- return selectMonitorSchema.parse(currentMonitor);
+ return parsedMonitor.data;
}),
update: protectedProcedure
@@ -153,7 +177,10 @@ export const monitorRouter = createTRPCRouter({
});
}
- const { regions, headers, notifications, pages, ...data } = opts.input;
+ console.log(opts.input);
+
+ const { regions, headers, notifications, pages, tags, ...data } =
+ opts.input;
const currentMonitor = await opts.ctx.db
.update(monitor)
@@ -213,6 +240,44 @@ export const monitorRouter = createTRPCRouter({
.run();
}
+ const currentMonitorTags = await opts.ctx.db
+ .select()
+ .from(monitorTagsToMonitors)
+ .where(eq(monitorTagsToMonitors.monitorId, currentMonitor.id))
+ .all();
+
+ const addedTags = tags.filter(
+ (x) =>
+ !currentMonitorTags
+ .map(({ monitorTagId }) => monitorTagId)
+ ?.includes(x),
+ );
+
+ if (addedTags.length > 0) {
+ const values = addedTags.map((monitorTagId) => ({
+ monitorId: currentMonitor.id,
+ monitorTagId,
+ }));
+
+ await opts.ctx.db.insert(monitorTagsToMonitors).values(values).run();
+ }
+
+ const removedTags = currentMonitorTags
+ .map(({ monitorTagId }) => monitorTagId)
+ .filter((x) => !tags?.includes(x));
+
+ if (removedTags.length > 0) {
+ await opts.ctx.db
+ .delete(monitorTagsToMonitors)
+ .where(
+ and(
+ eq(monitorTagsToMonitors.monitorId, currentMonitor.id),
+ inArray(monitorTagsToMonitors.monitorTagId, removedTags),
+ ),
+ )
+ .run();
+ }
+
const currentMonitorPages = await opts.ctx.db
.select()
.from(monitorsToPages)
@@ -270,16 +335,58 @@ export const monitorRouter = createTRPCRouter({
.run();
}),
- getMonitorsByWorkspace: protectedProcedure
- .output(z.array(selectMonitorSchema))
- .query(async (opts) => {
- const monitors = await opts.ctx.db
+ getMonitorsByWorkspace: protectedProcedure.query(async (opts) => {
+ const monitors = await opts.ctx.db.query.monitor.findMany({
+ where: eq(monitor.workspaceId, opts.ctx.workspace.id),
+ with: {
+ monitorTagsToMonitors: { with: { monitorTag: true } },
+ },
+ });
+
+ return z
+ .array(
+ selectMonitorSchema.extend({
+ monitorTagsToMonitors: z
+ .array(z.object({ monitorTag: selectMonitorTagSchema }))
+ .default([]),
+ }),
+ )
+ .parse(monitors);
+ }),
+
+ toggleMonitorActive: protectedProcedure
+ .input(z.object({ id: z.number() }))
+ .mutation(async (opts) => {
+ const monitorToUpdate = await opts.ctx.db
.select()
.from(monitor)
- .where(eq(monitor.workspaceId, opts.ctx.workspace.id))
- .all();
+ .where(
+ and(
+ eq(monitor.id, opts.input.id),
+ eq(monitor.workspaceId, opts.ctx.workspace.id),
+ ),
+ )
+ .get();
- return z.array(selectMonitorSchema).parse(monitors);
+ if (!monitorToUpdate) {
+ throw new TRPCError({
+ code: "NOT_FOUND",
+ message: "Monitor not found.",
+ });
+ }
+
+ await opts.ctx.db
+ .update(monitor)
+ .set({
+ active: !monitorToUpdate.active,
+ })
+ .where(
+ and(
+ eq(monitor.id, opts.input.id),
+ eq(monitor.workspaceId, opts.ctx.workspace.id),
+ ),
+ )
+ .run();
}),
// rename to getActiveMonitorsCount
diff --git a/packages/api/src/router/monitorTag.ts b/packages/api/src/router/monitorTag.ts
new file mode 100644
index 000000000..d534abd1c
--- /dev/null
+++ b/packages/api/src/router/monitorTag.ts
@@ -0,0 +1,61 @@
+import { TRPCError } from "@trpc/server";
+import { z } from "zod";
+
+import { and, eq } from "@openstatus/db";
+import { insertMonitorTagSchema, monitorTag } from "@openstatus/db/src/schema";
+
+import { createTRPCRouter, protectedProcedure } from "../trpc";
+
+export const monitorTagRouter = createTRPCRouter({
+ getMonitorTagsByWorkspace: protectedProcedure.query(async (opts) => {
+ return opts.ctx.db.query.monitorTag.findMany({
+ where: eq(monitorTag.workspaceId, opts.ctx.workspace.id),
+ with: { monitor: true },
+ });
+ }),
+
+ update: protectedProcedure
+ .input(insertMonitorTagSchema)
+ .mutation(async (opts) => {
+ if (!opts.input.id) return;
+ return await opts.ctx.db
+ .update(monitorTag)
+ .set({ name: opts.input.name, color: opts.input.color })
+ .where(
+ and(
+ eq(monitorTag.workspaceId, opts.ctx.workspace.id),
+ eq(monitorTag.id, opts.input.id),
+ ),
+ )
+ .returning()
+ .get();
+ }),
+
+ delete: protectedProcedure
+ .input(z.object({ id: z.number() }))
+ .mutation(async (opts) => {
+ await opts.ctx.db
+ .delete(monitorTag)
+ .where(
+ and(
+ eq(monitorTag.id, opts.input.id),
+ eq(monitorTag.workspaceId, opts.ctx.workspace.id),
+ ),
+ )
+ .run();
+ }),
+
+ create: protectedProcedure
+ .input(z.object({ name: z.string(), color: z.string() }))
+ .mutation(async (opts) => {
+ return opts.ctx.db
+ .insert(monitorTag)
+ .values({
+ name: opts.input.name,
+ color: opts.input.color,
+ workspaceId: opts.ctx.workspace.id,
+ })
+ .returning()
+ .get();
+ }),
+});
diff --git a/packages/db/drizzle/0021_reflective_nico_minoru.sql b/packages/db/drizzle/0021_reflective_nico_minoru.sql
new file mode 100644
index 000000000..e623e113a
--- /dev/null
+++ b/packages/db/drizzle/0021_reflective_nico_minoru.sql
@@ -0,0 +1,18 @@
+CREATE TABLE `monitor_tag` (
+ `id` integer PRIMARY KEY NOT NULL,
+ `workspace_id` integer NOT NULL,
+ `name` text NOT NULL,
+ `color` text NOT NULL,
+ `created_at` integer DEFAULT (strftime('%s', 'now')),
+ `updated_at` integer DEFAULT (strftime('%s', 'now')),
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE TABLE `monitor_tag_to_monitor` (
+ `monitor_id` integer NOT NULL,
+ `monitor_tag_id` integer NOT NULL,
+ `created_at` integer DEFAULT (strftime('%s', 'now')),
+ PRIMARY KEY(`monitor_id`, `monitor_tag_id`),
+ FOREIGN KEY (`monitor_id`) REFERENCES `monitor`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`monitor_tag_id`) REFERENCES `monitor_tag`(`id`) ON UPDATE no action ON DELETE cascade
+);
diff --git a/packages/db/drizzle/meta/0021_snapshot.json b/packages/db/drizzle/meta/0021_snapshot.json
new file mode 100644
index 000000000..aeb9af335
--- /dev/null
+++ b/packages/db/drizzle/meta/0021_snapshot.json
@@ -0,0 +1,1605 @@
+{
+ "version": "5",
+ "dialect": "sqlite",
+ "id": "44c2bbb5-69d5-40e8-b301-f2569bc2e499",
+ "prevId": "47000fd1-f273-4406-8380-803a0a63bc59",
+ "tables": {
+ "status_report_to_monitors": {
+ "name": "status_report_to_monitors",
+ "columns": {
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status_report_id": {
+ "name": "status_report_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "status_report_to_monitors_monitor_id_monitor_id_fk": {
+ "name": "status_report_to_monitors_monitor_id_monitor_id_fk",
+ "tableFrom": "status_report_to_monitors",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "status_report_to_monitors_status_report_id_status_report_id_fk": {
+ "name": "status_report_to_monitors_status_report_id_status_report_id_fk",
+ "tableFrom": "status_report_to_monitors",
+ "tableTo": "status_report",
+ "columnsFrom": [
+ "status_report_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "status_report_to_monitors_monitor_id_status_report_id_pk": {
+ "columns": [
+ "monitor_id",
+ "status_report_id"
+ ],
+ "name": "status_report_to_monitors_monitor_id_status_report_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "status_reports_to_pages": {
+ "name": "status_reports_to_pages",
+ "columns": {
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status_report_id": {
+ "name": "status_report_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "status_reports_to_pages_page_id_page_id_fk": {
+ "name": "status_reports_to_pages_page_id_page_id_fk",
+ "tableFrom": "status_reports_to_pages",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "status_reports_to_pages_status_report_id_status_report_id_fk": {
+ "name": "status_reports_to_pages_status_report_id_status_report_id_fk",
+ "tableFrom": "status_reports_to_pages",
+ "tableTo": "status_report",
+ "columnsFrom": [
+ "status_report_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "status_reports_to_pages_page_id_status_report_id_pk": {
+ "columns": [
+ "page_id",
+ "status_report_id"
+ ],
+ "name": "status_reports_to_pages_page_id_status_report_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "status_report": {
+ "name": "status_report",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "status_report_workspace_id_workspace_id_fk": {
+ "name": "status_report_workspace_id_workspace_id_fk",
+ "tableFrom": "status_report",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "status_report_update": {
+ "name": "status_report_update",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text(4)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "date": {
+ "name": "date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status_report_id": {
+ "name": "status_report_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "status_report_update_status_report_id_status_report_id_fk": {
+ "name": "status_report_update_status_report_id_status_report_id_fk",
+ "tableFrom": "status_report_update",
+ "tableTo": "status_report",
+ "columnsFrom": [
+ "status_report_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "integration": {
+ "name": "integration",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "credential": {
+ "name": "credential",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "data": {
+ "name": "data",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_workspace_id_workspace_id_fk": {
+ "name": "integration_workspace_id_workspace_id_fk",
+ "tableFrom": "integration",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "page": {
+ "name": "page",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "custom_domain": {
+ "name": "custom_domain",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "published": {
+ "name": "published",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "page_slug_unique": {
+ "name": "page_slug_unique",
+ "columns": [
+ "slug"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "page_workspace_id_workspace_id_fk": {
+ "name": "page_workspace_id_workspace_id_fk",
+ "tableFrom": "page",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "monitor": {
+ "name": "monitor",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "job_type": {
+ "name": "job_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'other'"
+ },
+ "periodicity": {
+ "name": "periodicity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'other'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "active": {
+ "name": "active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "regions": {
+ "name": "regions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "url": {
+ "name": "url",
+ "type": "text(2048)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "headers": {
+ "name": "headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "method": {
+ "name": "method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'GET'"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "monitor_workspace_id_workspace_id_fk": {
+ "name": "monitor_workspace_id_workspace_id_fk",
+ "tableFrom": "monitor",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "monitors_to_pages": {
+ "name": "monitors_to_pages",
+ "columns": {
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "monitors_to_pages_monitor_id_monitor_id_fk": {
+ "name": "monitors_to_pages_monitor_id_monitor_id_fk",
+ "tableFrom": "monitors_to_pages",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "monitors_to_pages_page_id_page_id_fk": {
+ "name": "monitors_to_pages_page_id_page_id_fk",
+ "tableFrom": "monitors_to_pages",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "monitors_to_pages_monitor_id_page_id_pk": {
+ "columns": [
+ "monitor_id",
+ "page_id"
+ ],
+ "name": "monitors_to_pages_monitor_id_page_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_name": {
+ "name": "last_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "photo_url": {
+ "name": "photo_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "user_tenant_id_unique": {
+ "name": "user_tenant_id_unique",
+ "columns": [
+ "tenant_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "users_to_workspaces": {
+ "name": "users_to_workspaces",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'member'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "users_to_workspaces_user_id_user_id_fk": {
+ "name": "users_to_workspaces_user_id_user_id_fk",
+ "tableFrom": "users_to_workspaces",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "users_to_workspaces_workspace_id_workspace_id_fk": {
+ "name": "users_to_workspaces_workspace_id_workspace_id_fk",
+ "tableFrom": "users_to_workspaces",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "users_to_workspaces_user_id_workspace_id_pk": {
+ "columns": [
+ "user_id",
+ "workspace_id"
+ ],
+ "name": "users_to_workspaces_user_id_workspace_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "page_subscriber": {
+ "name": "page_subscriber",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "page_subscriber_page_id_page_id_fk": {
+ "name": "page_subscriber_page_id_page_id_fk",
+ "tableFrom": "page_subscriber",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "workspace": {
+ "name": "workspace",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripe_id": {
+ "name": "stripe_id",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ends_at": {
+ "name": "ends_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "paid_until": {
+ "name": "paid_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "columns": [
+ "slug"
+ ],
+ "isUnique": true
+ },
+ "workspace_stripe_id_unique": {
+ "name": "workspace_stripe_id_unique",
+ "columns": [
+ "stripe_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "notification": {
+ "name": "notification",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "data": {
+ "name": "data",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_workspace_id_workspace_id_fk": {
+ "name": "notification_workspace_id_workspace_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "notifications_to_monitors": {
+ "name": "notifications_to_monitors",
+ "columns": {
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notification_id": {
+ "name": "notification_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notifications_to_monitors_monitor_id_monitor_id_fk": {
+ "name": "notifications_to_monitors_monitor_id_monitor_id_fk",
+ "tableFrom": "notifications_to_monitors",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notifications_to_monitors_notification_id_notification_id_fk": {
+ "name": "notifications_to_monitors_notification_id_notification_id_fk",
+ "tableFrom": "notifications_to_monitors",
+ "tableTo": "notification",
+ "columnsFrom": [
+ "notification_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "notifications_to_monitors_monitor_id_notification_id_pk": {
+ "columns": [
+ "monitor_id",
+ "notification_id"
+ ],
+ "name": "notifications_to_monitors_monitor_id_notification_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "monitor_status": {
+ "name": "monitor_status",
+ "columns": {
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "region": {
+ "name": "region",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "monitor_status_idx": {
+ "name": "monitor_status_idx",
+ "columns": [
+ "monitor_id",
+ "region"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "monitor_status_monitor_id_monitor_id_fk": {
+ "name": "monitor_status_monitor_id_monitor_id_fk",
+ "tableFrom": "monitor_status",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "monitor_status_monitor_id_region_pk": {
+ "columns": [
+ "monitor_id",
+ "region"
+ ],
+ "name": "monitor_status_monitor_id_region_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "invitation": {
+ "name": "invitation",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'member'"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "incident": {
+ "name": "incident",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'triage'"
+ },
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "acknowledged_by": {
+ "name": "acknowledged_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "resolved_by": {
+ "name": "resolved_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "auto_resolved": {
+ "name": "auto_resolved",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "incident_monitor_id_started_at_unique": {
+ "name": "incident_monitor_id_started_at_unique",
+ "columns": [
+ "monitor_id",
+ "started_at"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "incident_monitor_id_monitor_id_fk": {
+ "name": "incident_monitor_id_monitor_id_fk",
+ "tableFrom": "incident",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set default",
+ "onUpdate": "no action"
+ },
+ "incident_workspace_id_workspace_id_fk": {
+ "name": "incident_workspace_id_workspace_id_fk",
+ "tableFrom": "incident",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "incident_acknowledged_by_user_id_fk": {
+ "name": "incident_acknowledged_by_user_id_fk",
+ "tableFrom": "incident",
+ "tableTo": "user",
+ "columnsFrom": [
+ "acknowledged_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "incident_resolved_by_user_id_fk": {
+ "name": "incident_resolved_by_user_id_fk",
+ "tableFrom": "incident",
+ "tableTo": "user",
+ "columnsFrom": [
+ "resolved_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "monitor_tag": {
+ "name": "monitor_tag",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "monitor_tag_workspace_id_workspace_id_fk": {
+ "name": "monitor_tag_workspace_id_workspace_id_fk",
+ "tableFrom": "monitor_tag",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "monitor_tag_to_monitor": {
+ "name": "monitor_tag_to_monitor",
+ "columns": {
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "monitor_tag_id": {
+ "name": "monitor_tag_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "monitor_tag_to_monitor_monitor_id_monitor_id_fk": {
+ "name": "monitor_tag_to_monitor_monitor_id_monitor_id_fk",
+ "tableFrom": "monitor_tag_to_monitor",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk": {
+ "name": "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk",
+ "tableFrom": "monitor_tag_to_monitor",
+ "tableTo": "monitor_tag",
+ "columnsFrom": [
+ "monitor_tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk": {
+ "columns": [
+ "monitor_id",
+ "monitor_tag_id"
+ ],
+ "name": "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index d08613273..24efb5b40 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -148,6 +148,13 @@
"when": 1707905605592,
"tag": "0020_flat_bedlam",
"breakpoints": true
+ },
+ {
+ "idx": 21,
+ "version": "5",
+ "when": 1710677383007,
+ "tag": "0021_reflective_nico_minoru",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts
index bdd284b90..b4ff1dd41 100644
--- a/packages/db/src/schema/index.ts
+++ b/packages/db/src/schema/index.ts
@@ -10,3 +10,4 @@ export * from "./notifications";
export * from "./monitor_status";
export * from "./invitations";
export * from "./incidents";
+export * from "./monitor_tags";
diff --git a/packages/db/src/schema/monitor_tags/index.ts b/packages/db/src/schema/monitor_tags/index.ts
new file mode 100644
index 000000000..dcd6fafd2
--- /dev/null
+++ b/packages/db/src/schema/monitor_tags/index.ts
@@ -0,0 +1,2 @@
+export * from "./monitor_tag";
+export * from "./validation";
diff --git a/packages/db/src/schema/monitor_tags/monitor_tag.ts b/packages/db/src/schema/monitor_tags/monitor_tag.ts
new file mode 100644
index 000000000..4f9b484fa
--- /dev/null
+++ b/packages/db/src/schema/monitor_tags/monitor_tag.ts
@@ -0,0 +1,67 @@
+import { relations, sql } from "drizzle-orm";
+import {
+ integer,
+ primaryKey,
+ sqliteTable,
+ text,
+} from "drizzle-orm/sqlite-core";
+
+import { monitor } from "../monitors";
+import { workspace } from "../workspaces";
+
+export const monitorTag = sqliteTable("monitor_tag", {
+ id: integer("id").primaryKey(),
+ workspaceId: integer("workspace_id")
+ .references(() => workspace.id, { onDelete: "cascade" })
+ .notNull(),
+
+ name: text("name").notNull(),
+ color: text("color").notNull(),
+
+ createdAt: integer("created_at", { mode: "timestamp" }).default(
+ sql`(strftime('%s', 'now'))`,
+ ),
+ updatedAt: integer("updated_at", { mode: "timestamp" }).default(
+ sql`(strftime('%s', 'now'))`,
+ ),
+});
+
+export const monitorTagsToMonitors = sqliteTable(
+ "monitor_tag_to_monitor",
+ {
+ monitorId: integer("monitor_id")
+ .notNull()
+ .references(() => monitor.id, { onDelete: "cascade" }),
+ monitorTagId: integer("monitor_tag_id")
+ .notNull()
+ .references(() => monitorTag.id, { onDelete: "cascade" }),
+ createdAt: integer("created_at", { mode: "timestamp" }).default(
+ sql`(strftime('%s', 'now'))`,
+ ),
+ },
+ (t) => ({
+ pk: primaryKey(t.monitorId, t.monitorTagId),
+ }),
+);
+
+export const monitorTagsToMonitorsRelation = relations(
+ monitorTagsToMonitors,
+ ({ one }) => ({
+ monitor: one(monitor, {
+ fields: [monitorTagsToMonitors.monitorId],
+ references: [monitor.id],
+ }),
+ monitorTag: one(monitorTag, {
+ fields: [monitorTagsToMonitors.monitorTagId],
+ references: [monitorTag.id],
+ }),
+ }),
+);
+
+export const monitorTagRelations = relations(monitorTag, ({ one, many }) => ({
+ monitor: many(monitorTagsToMonitors),
+ workspace: one(workspace, {
+ fields: [monitorTag.workspaceId],
+ references: [workspace.id],
+ }),
+}));
diff --git a/packages/db/src/schema/monitor_tags/validation.ts b/packages/db/src/schema/monitor_tags/validation.ts
new file mode 100644
index 000000000..48f97720f
--- /dev/null
+++ b/packages/db/src/schema/monitor_tags/validation.ts
@@ -0,0 +1,11 @@
+import { createInsertSchema, createSelectSchema } from "drizzle-zod";
+import type { z } from "zod";
+
+import { monitorTag } from "./monitor_tag";
+
+export const selectMonitorTagSchema = createSelectSchema(monitorTag);
+
+export const insertMonitorTagSchema = createInsertSchema(monitorTag);
+
+export type InsertMonitorTag = z.infer<typeof insertMonitorTagSchema>;
+export type MonitorTag = z.infer<typeof selectMonitorTagSchema>;
diff --git a/packages/db/src/schema/monitors/monitor.ts b/packages/db/src/schema/monitors/monitor.ts
index 43d0ec140..af2905742 100644
--- a/packages/db/src/schema/monitors/monitor.ts
+++ b/packages/db/src/schema/monitors/monitor.ts
@@ -6,6 +6,7 @@ import {
text,
} from "drizzle-orm/sqlite-core";
+import { monitorTagsToMonitors } from "../monitor_tags";
import { notificationsToMonitors } from "../notifications";
import { page } from "../pages";
import { monitorsToStatusReport } from "../status_reports";
@@ -51,6 +52,7 @@ export const monitor = sqliteTable("monitor", {
export const monitorRelation = relations(monitor, ({ one, many }) => ({
monitorsToPages: many(monitorsToPages),
monitorsToStatusReports: many(monitorsToStatusReport),
+ monitorTagsToMonitors: many(monitorTagsToMonitors),
workspace: one(workspace, {
fields: [monitor.workspaceId],
references: [workspace.id],
diff --git a/packages/db/src/schema/monitors/validation.ts b/packages/db/src/schema/monitors/validation.ts
index 7115bc630..0f6f01e47 100644
--- a/packages/db/src/schema/monitors/validation.ts
+++ b/packages/db/src/schema/monitors/validation.ts
@@ -72,6 +72,7 @@ export const insertMonitorSchema = createInsertSchema(monitor, {
notifications: z.array(z.number()).optional().default([]),
pages: z.array(z.number()).optional().default([]),
body: z.string().default("").optional(),
+ tags: z.array(z.number()).optional().default([]),
});
export type InsertMonitor = z.infer<typeof insertMonitorSchema>;
diff --git a/packages/tinybird/src/os-client.ts b/packages/tinybird/src/os-client.ts
index ae25db697..726615687 100644
--- a/packages/tinybird/src/os-client.ts
+++ b/packages/tinybird/src/os-client.ts
@@ -3,9 +3,13 @@ import { z } from "zod";
import { flyRegions } from "@openstatus/utils";
-const MIN_CACHE = 60; // 60s
-const DEFAULT_CACHE = 120; // 2min
-const MAX_CACHE = 86400; // 1d
+const isProd = process.env.NODE_ENV === "production";
+
+const DEV_CACHE = 3_600; // 1h
+
+const MIN_CACHE = isProd ? 60 : DEV_CACHE; // 60s
+const DEFAULT_CACHE = isProd ? 120 : DEV_CACHE; // 2min
+const MAX_CACHE = 86_400; // 1d
export const latencySchema = z.object({
p50Latency: z.number().int().nullable(),
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 6d46f0166..e19cb710d 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -23,7 +23,7 @@
"@radix-ui/react-alert-dialog": "1.0.5",
"@radix-ui/react-avatar": "1.0.4",
"@radix-ui/react-checkbox": "1.0.4",
- "@radix-ui/react-collapsible": "^1.0.3",
+ "@radix-ui/react-collapsible": "1.0.3",
"@radix-ui/react-context-menu": "2.1.5",
"@radix-ui/react-dialog": "1.0.4",
"@radix-ui/react-dropdown-menu": "2.0.6",
@@ -37,7 +37,7 @@
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-switch": "1.0.3",
"@radix-ui/react-tabs": "1.0.4",
- "@radix-ui/react-toggle": "^1.0.3",
+ "@radix-ui/react-toggle": "1.0.3",
"@radix-ui/react-tooltip": "1.0.7",
"class-variance-authority": "0.7.0",
"clsx": "2.0.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a2d8a4e91..2ff927bea 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -805,7 +805,7 @@ importers:
specifier: 1.0.4
'@radix-ui/react-collapsible':
- specifier: ^1.0.3
+ specifier: 1.0.3
'@radix-ui/react-context-menu':
specifier: 2.1.5
@@ -847,7 +847,7 @@ importers:
specifier: 1.0.4
'@radix-ui/react-toggle':
- specifier: ^1.0.3
+ specifier: 1.0.3
'@radix-ui/react-tooltip':
specifier: 1.0.7