diff --git a/apps/web/src/app/api/og/route.tsx b/apps/web/src/app/api/og/route.tsx
index 2ac2e574..66bda1d7 100644
--- a/apps/web/src/app/api/og/route.tsx
+++ b/apps/web/src/app/api/og/route.tsx
@@ -41,10 +41,11 @@ export async function GET(req: Request) {
? searchParams.get("monitorId")
: undefined;
+ // currently, we only show the tracker for a single(!) monitor
const data =
(monitorId &&
(await getMonitorListData({
- siteId: monitorId,
+ monitorId,
groupBy: "day",
limit: LIMIT,
}))) ||
@@ -97,19 +98,20 @@ export async function GET(req: Request) {
return (
);
})}
{data.map((item, i) => {
- const status = item.ok / item.count === 1 ? "up" : "down"; // needs to be better defined!
+ const { variant } = getStatus(item.ok / item.count);
return (
);
@@ -150,3 +152,12 @@ export async function GET(req: Request) {
},
);
}
+
+// FIXME this is a temporary solution (taken from Tracker)
+const getStatus = (
+ ratio: number,
+): { label: string; variant: "up" | "degraded" | "down" } => {
+ if (ratio >= 0.98) return { label: "Operational", variant: "up" };
+ if (ratio >= 0.5) return { label: "Degraded", variant: "degraded" };
+ return { label: "Downtime", variant: "down" };
+};
diff --git a/apps/web/src/app/status-page/[domain]/page.tsx b/apps/web/src/app/status-page/[domain]/page.tsx
index 68c3cd62..45b23af7 100644
--- a/apps/web/src/app/status-page/[domain]/page.tsx
+++ b/apps/web/src/app/status-page/[domain]/page.tsx
@@ -35,19 +35,20 @@ export default async function Page({ params }: Props) {
export async function generateMetadata({ params }: Props): Promise
{
const page = await api.page.getPageBySlug.query({ slug: params.domain });
+ const firstMonitor = page?.monitors?.[0]; // temporary solution
return {
title: page?.title,
description: page?.description,
twitter: {
- images: [`/api/og?monitorId=${page?.id}`],
+ images: [`/api/og?monitorId=${firstMonitor?.id}`],
card: "summary_large_image",
title: page?.title,
description: page?.description,
},
openGraph: {
type: "website",
- images: [`/api/og?monitorId=${page?.id}`],
+ images: [`/api/og?monitorId=${firstMonitor?.id}`],
title: page?.title,
description: page?.description,
},
diff --git a/apps/web/src/lib/tb.ts b/apps/web/src/lib/tb.ts
index 841440b5..73095ebc 100644
--- a/apps/web/src/lib/tb.ts
+++ b/apps/web/src/lib/tb.ts
@@ -15,10 +15,7 @@ const tb = new Tinybird({ token: env.TINY_BIRD_API_KEY });
// TODO: add security layer
export async function getResponseListData(
props: Partial<
- Pick<
- ResponseListParams,
- "siteId" | "region" | "cronTimestamp" | "limit" | "monitorId"
- >
+ Pick
>,
) {
try {
diff --git a/packages/tinybird/src/validation.ts b/packages/tinybird/src/validation.ts
index b7b790ac..92648062 100644
--- a/packages/tinybird/src/validation.ts
+++ b/packages/tinybird/src/validation.ts
@@ -65,7 +65,6 @@ export const tbBuildResponseList = z.object({
* Params for pipe response_list__v1
*/
export const tbParameterResponseList = z.object({
- siteId: z.string().optional().default(""), // REMINDER: remove default once alpha
monitorId: z.string().default(""), // REMINDER: remove default once alpha
fromDate: z.number().int().default(0), // always start from a date
toDate: z.number().int().optional(),