Openstatus www.openstatus.dev

fix: frequency and cron jobs on pro plan (#184)

authored by

Maximilian Kaske and committed by
GitHub
6b182a75 25aad594

+28 -2
+7
apps/web/.env.example
··· 36 36 37 37 # For vercel upload 38 38 BLOB_READ_WRITE_TOKEN=blob-read-write-token 39 + 40 + # STRIPE 41 + NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= 42 + STRIPE_SECRET_KEY= 43 + STRIPE_PRO_MONTHLY_PRICE_ID= 44 + STRIPE_PRO_PRODUCT_ID= 45 + STRIPE_WEBHOOK_SECRET_KEY=
+5
apps/web/src/app/app/(dashboard)/[workspaceSlug]/monitors/edit/page.tsx
··· 29 29 30 30 const monitor = id && (await api.monitor.getMonitorByID.query({ id })); 31 31 32 + const workspace = await api.workspace.getWorkspace.query({ 33 + slug: params.workspaceSlug, 34 + }); 35 + 32 36 return ( 33 37 <div className="grid gap-6 md:grid-cols-2 md:gap-8"> 34 38 <Header title="Monitor" description="Upsert your monitor." /> ··· 36 40 <MonitorForm 37 41 workspaceSlug={params.workspaceSlug} 38 42 defaultValues={monitor || undefined} 43 + plan={workspace?.plan} 39 44 /> 40 45 </div> 41 46 </div>
+8 -2
apps/web/src/components/forms/montitor-form.tsx
··· 50 50 import { LoadingAnimation } from "../loading-animation"; 51 51 import { useToast } from "../ui/use-toast"; 52 52 53 - const limit = allPlans.free.limits.periodicity; 54 53 const cronJobs = [ 55 54 { value: "1m", label: "1 minute" }, 56 55 { value: "5m", label: "5 minutes" }, ··· 64 63 interface Props { 65 64 defaultValues?: MonitorProps; 66 65 workspaceSlug: string; 66 + plan?: "free" | "pro"; // HOTFIX - We can think of returning `workspace` instead of `workspaceSlug` 67 67 } 68 68 69 - export function MonitorForm({ defaultValues, workspaceSlug }: Props) { 69 + export function MonitorForm({ 70 + defaultValues, 71 + workspaceSlug, 72 + plan = "free", 73 + }: Props) { 70 74 const form = useForm<MonitorProps>({ 71 75 resolver: zodResolver(insertMonitorSchema), // too much - we should only validate the values we ask inside of the form! 72 76 defaultValues: { ··· 105 109 } 106 110 }); 107 111 }; 112 + 113 + const limit = allPlans[plan].limits.periodicity; 108 114 109 115 return ( 110 116 <Form {...form}>
+8
apps/web/vercel.json
··· 1 1 { 2 2 "crons": [ 3 3 { 4 + "path": "/api/checker/cron/1m", 5 + "schedule": "* * * * *" 6 + }, 7 + { 8 + "path": "/api/checker/cron/5m", 9 + "schedule": "*/5 * * * *" 10 + }, 11 + { 4 12 "path": "/api/checker/cron/10m", 5 13 "schedule": "*/10 * * * *" 6 14 },