From 40a2259767b4985cdd9aadd2706df58966527d12 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Sun, 21 Dec 2025 00:01:03 +0000 Subject: [PATCH] Document each fn --- .../route.tsx | 1242 ++++++++++++----- 1 file changed, 876 insertions(+), 366 deletions(-) diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx index a7716aa63..737ccd7bb 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx @@ -51,6 +51,7 @@ import { import { Select, SelectItem } from "~/components/primitives/Select"; import { Spinner } from "~/components/primitives/Spinner"; import { Switch } from "~/components/primitives/Switch"; +import { SimpleTooltip } from "~/components/primitives/Tooltip"; import { useEnvironment } from "~/hooks/useEnvironment"; import { useOrganization } from "~/hooks/useOrganizations"; import { useProject } from "~/hooks/useProject"; @@ -728,44 +729,96 @@ ORDER BY run_count DESC`, {/* Functions */}
Available functions + + Hover over any function to see its description and example usage. +
{/* Aggregate functions */} @@ -773,53 +826,148 @@ ORDER BY run_count DESC`, @@ -827,69 +975,155 @@ ORDER BY run_count DESC`, @@ -897,15 +1131,46 @@ ORDER BY run_count DESC`, @@ -913,46 +1178,57 @@ ORDER BY run_count DESC`, @@ -960,47 +1236,111 @@ ORDER BY run_count DESC`, x > 0, arr)", + }, + { + name: "arrayMap(func, arr)", + desc: "Transform each element", + example: "arrayMap(x -> x * 2, arr)", + }, + { + name: "arrayMin(arr)", + desc: "Minimum element", + example: "arrayMin(array(1, 2, 3))", + }, + { + name: "arrayMax(arr)", + desc: "Maximum element", + example: "arrayMax(array(1, 2, 3))", + }, + { + name: "arraySum(arr)", + desc: "Sum of elements", + example: "arraySum(array(1, 2, 3))", + }, + { + name: "arrayAvg(arr)", + desc: "Average of elements", + example: "arrayAvg(array(1, 2, 3))", + }, ]} /> @@ -1008,20 +1348,61 @@ ORDER BY run_count DESC`, @@ -1029,30 +1410,45 @@ ORDER BY run_count DESC`, @@ -1060,18 +1456,48 @@ ORDER BY run_count DESC`, b)", + example: "greater(usage_duration, 1000)", + }, + { + name: "lessOrEquals(a, b)", + desc: "Less than or equal (a <= b)", + example: "lessOrEquals(attempt, 5)", + }, + { + name: "greaterOrEquals(a, b)", + desc: "Greater than or equal (a >= b)", + example: "greaterOrEquals(usage_duration, 0)", + }, + { + name: "and(a, b, ...)", + desc: "Logical AND", + example: "and(status = 'Failed', attempt > 1)", + }, + { + name: "or(a, b, ...)", + desc: "Logical OR", + example: "or(status = 'Failed', status = 'Crashed')", + }, + { name: "not(x)", desc: "Logical NOT", example: "not(is_test)" }, + { + name: "in(x, set)", + desc: "Check if x is in set", + example: "in(status, ('Failed', 'Crashed'))", + }, ]} /> @@ -1079,65 +1505,64 @@ ORDER BY run_count DESC`, - {/* URL functions */} - - - {/* UUID & other */} + {/* UUID & utility */} @@ -1145,14 +1570,33 @@ ORDER BY run_count DESC`, @@ -1160,14 +1604,41 @@ ORDER BY run_count DESC`, @@ -1175,14 +1646,41 @@ ORDER BY run_count DESC`,
@@ -1191,7 +1689,9 @@ ORDER BY run_count DESC`, ); } -function FunctionCategory({ title, functions }: { title: string; functions: string[] }) { +type FunctionDoc = { name: string; desc: string; example: string }; + +function FunctionCategory({ title, functions }: { title: string; functions: FunctionDoc[] }) { return (
@@ -1199,12 +1699,22 @@ function FunctionCategory({ title, functions }: { title: string; functions: stri
{functions.map((fn) => ( - - {fn} - + + {fn.name} + + } + content={ +
+
{fn.desc}
+ + {fn.example} + +
+ } + /> ))}