Skip to content

Automate browser based workflows with AI

feat: add /analytics route + page shell + nav item (SKY-9072) (#5980)

Aaron Perezf1b6a9910922
diff --git a/skyvern-frontend/src/components/TableSearchInput.tsx b/skyvern-frontend/src/components/TableSearchInput.tsx
index 907e2f200..ec5ca89e4 100644
--- a/skyvern-frontend/src/components/TableSearchInput.tsx
+++ b/skyvern-frontend/src/components/TableSearchInput.tsx
@@ -9,6 +9,7 @@ type TableSearchInputProps = {
placeholder?: string;
className?: string;
inputClassName?: string;
+ disabled?: boolean;
};
function TableSearchInput({
@@ -17,6 +18,7 @@ function TableSearchInput({
placeholder = "Search…",
className,
inputClassName,
+ disabled,
}: TableSearchInputProps) {
function handleChange(event: ChangeEvent<HTMLInputElement>) {
onChange(event.target.value);
@@ -31,6 +33,7 @@ function TableSearchInput({
value={value}
onChange={handleChange}
placeholder={placeholder}
+ disabled={disabled}
className={cn("pl-9", inputClassName)}
/>
</div>
diff --git a/skyvern-frontend/src/components/dashboard-load-state.test.tsx b/skyvern-frontend/src/components/dashboard-load-state.test.tsx
new file mode 100644
index 000000000..addd37c32
--- /dev/null
+++ b/skyvern-frontend/src/components/dashboard-load-state.test.tsx
@@ -0,0 +1,187 @@
+import { describe, expect, it } from "vitest";
+import { renderToStaticMarkup } from "react-dom/server";
+import { DashboardLoadState } from "./dashboard-load-state";
+import { isDashboardLoadStateActive } from "@/util/dashboardLoadStateActive";
+
+describe("DashboardLoadState", () => {
+ it("returns null when data is present (no loading/error/empty)", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError={false}
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toBe("");
+ });
+
+ it("renders the loading skeleton when isLoading", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading
+ isError={false}
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain('data-state="loading"');
+ expect(html).toContain("animate-pulse");
+ });
+
+ it("uses the supplied skeleton override when provided", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading
+ isError={false}
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ skeleton={<span data-testid="custom-skel">custom</span>}
+ />,
+ );
+ expect(html).toContain('data-testid="custom-skel"');
+ expect(html).toContain("custom");
+ });
+
+ it("renders the empty placeholder with the exact emptyCopy string", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError={false}
+ isEmpty
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain('data-state="empty"');
+ expect(html).toContain("No runs to chart for this period.");
+ });
+
+ it("renders the error alert with surface in the title and message in the description (no duplication)", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError
+ isEmpty={false}
+ error={new Error("backend exploded")}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain('data-state="error"');
+ expect(html).toContain("Couldn&#x27;t load runs chart");
+ expect(html).toContain("backend exploded");
+ const matches = html.match(/Couldn&#x27;t load runs chart/g) ?? [];
+ expect(matches.length).toBe(1);
+ });
+
+ it("falls back to a generic 'Try again.' description when error has no message", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain("Try again.");
+ const matches = html.match(/Couldn&#x27;t load runs chart/g) ?? [];
+ expect(matches.length).toBe(1);
+ });
+
+ it("loading wins over error when both are true (mid-refetch)", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading
+ isError
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain('data-state="loading"');
+ expect(html).not.toContain('data-state="error"');
+ });
+
+ it("renders the retry button only when a retry callback is provided and namespaces its testId", () => {
+ const withRetry = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError
+ isEmpty={false}
+ error={new Error("nope")}
+ retry={() => undefined}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ testId="runs-chart-load-state"
+ />,
+ );
+ expect(withRetry).toContain('data-testid="runs-chart-load-state-retry"');
+ expect(withRetry).toContain("Try again");
+
+ const withoutRetry = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError
+ isEmpty={false}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(withoutRetry).not.toContain("-retry");
+ });
+
+ it("falls back to dashboard-load-state-retry when no testId is provided", () => {
+ const html = renderToStaticMarkup(
+ <DashboardLoadState
+ isLoading={false}
+ isError
+ isEmpty={false}
+ retry={() => undefined}
+ surface="runs chart"
+ emptyCopy="No runs to chart for this period."
+ />,
+ );
+ expect(html).toContain('data-testid="dashboard-load-state-retry"');
+ });
+});
+
+describe("isDashboardLoadStateActive", () => {
+ it("returns false when none of loading/error/empty applies", () => {
+ expect(
+ isDashboardLoadStateActive({
+ isLoading: false,
+ isError: false,
+ isEmpty: false,
+ }),
+ ).toBe(false);
+ });
+
+ it("returns true when any one of loading/error/empty applies", () => {
+ expect(
+ isDashboardLoadStateActive({
+ isLoading: true,
+ isError: false,
+ isEmpty: false,
+ }),
+ ).toBe(true);
+ expect(
+ isDashboardLoadStateActive({
+ isLoading: false,
+ isError: true,
+ isEmpty: false,
+ }),
+ ).toBe(true);
+ expect(
+ isDashboardLoadStateActive({
+ isLoading: false,
+ isError: false,
+ isEmpty: true,
+ }),
+ ).toBe(true);
+ });
+});
diff --git a/skyvern-frontend/src/components/dashboard-load-state.tsx b/skyvern-frontend/src/components/dashboard-load-state.tsx
new file mode 100644
index 000000000..30869fb7f
--- /dev/null
+++ b/skyvern-frontend/src/components/dashboard-load-state.tsx
@@ -0,0 +1,119 @@
+import {
+ ExclamationTriangleIcon,
+ InfoCircledIcon,
+ ReloadIcon,
+} from "@radix-ui/react-icons";
+import * as React from "react";
+
+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
+import { Button } from "@/components/ui/button";
+import { Skeleton } from "@/components/ui/skeleton";
+import { cn } from "@/util/utils";
+
+type DashboardLoadStateProps = {
+ isLoading: boolean;
+ isError: boolean;
+ isEmpty: boolean;
+ error?: unknown;
+ retry?: () => void;
+ surface: string;
+ emptyCopy: string;
+ skeleton?: React.ReactNode;
+ containerClassName?: string;
+ testId?: string;
+};
+
+const InfoIcon = InfoCircledIcon;
+
+function errorDescription(error: unknown): string {
+ if (error && typeof error === "object" && "message" in error) {
+ const tail = String((error as { message: unknown }).message ?? "").trim();
+ if (tail.length > 0) {
+ return tail;
+ }
+ }
+ return "Try again.";
+}
+
+function DashboardLoadState({
+ isLoading,
+ isError,
+ isEmpty,
+ error,
+ retry,
+ surface,
+ emptyCopy,
+ skeleton,
+ containerClassName,
+ testId,
+}: DashboardLoadStateProps): React.ReactElement | null {
+ // priority: loading > error > empty
+ if (isLoading) {
+ return (
+ <div
+ data-testid={testId ?? "dashboard-load-state"}
+ data-state="loading"
+ className={cn("w-full", containerClassName)}
+ >
+ {skeleton ?? <Skeleton className="h-32 w-full" />}
+ </div>
+ );
+ }
+
+ if (isError) {
+ return (
+ <div
+ data-testid={testId ?? "dashboard-load-state"}
+ data-state="error"
+ className={cn("w-full", containerClassName)}
+ >
+ <Alert variant="destructive">
+ <ExclamationTriangleIcon className="h-4 w-4" />
+ <AlertTitle>Couldn&apos;t load {surface}</AlertTitle>
+ <AlertDescription className="flex flex-col gap-3">
+ <span>{errorDescription(error)}</span>
+ {retry ? (
+ <span>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={retry}
+ data-testid={`${testId ?? "dashboard-load-state"}-retry`}
+ className="gap-2"
+ >
+ <ReloadIcon className="h-3 w-3" aria-hidden="true" />
+ Try again
+ </Button>
+ </span>
+ ) : null}
+ </AlertDescription>
+ </Alert>
+ </div>
+ );
+ }
+
+ if (isEmpty) {
+ return (
+ <div
+ data-testid={testId ?? "dashboard-load-state"}
+ data-state="empty"
+ className={cn(
+ "flex w-full flex-col items-center justify-center gap-2 text-center",
+ containerClassName,
+ )}
+ >
+ <InfoIcon
+ className="h-6 w-6 text-muted-foreground"
+ aria-hidden="true"
+ />
+ <p className="text-sm text-muted-foreground">{emptyCopy}</p>
+ </div>
+ );
+ }
+
+ return null;
+}
+
+export { DashboardLoadState };
+export type { DashboardLoadStateProps };
diff --git a/skyvern-frontend/src/components/ui/card-variants.test.ts b/skyvern-frontend/src/components/ui/card-variants.test.ts
index 8ca542180..ecfe047cf 100644
--- a/skyvern-frontend/src/components/ui/card-variants.test.ts
+++ b/skyvern-frontend/src/components/ui/card-variants.test.ts
@@ -2,10 +2,6 @@ import { describe, expect, it } from "vitest";
import { cardVariants } from "./card-variants";
describe("cardVariants", () => {
- // Pre-cva Card class string was:
- // "rounded-xl border bg-card text-card-foreground shadow"
- // Default tone MUST emit those same classes (order-insensitive — twMerge
- // resolves ordering when cn() composes them with caller className).
it("returns the legacy class set for tone=default (existing-caller preservation)", () => {
const result = cardVariants({ tone: "default" });
expect(result).toContain("rounded-xl");
@@ -35,8 +31,6 @@ describe("cardVariants", () => {
});
it("keeps the rounded-xl + shadow + bg-card base across all tones (border-tint only)", () => {
- // Tones are border-tints only — full background washes were out-of-scope
- // per mandate. A destructive Card still reads as a Card, not a Banner.
for (const tone of [
"default",
"success",
diff --git a/skyvern-frontend/src/components/ui/css-vars.test.ts b/skyvern-frontend/src/components/ui/css-vars.test.ts
index b2d0d7871..08a57ec6d 100644
--- a/skyvern-frontend/src/components/ui/css-vars.test.ts
+++ b/skyvern-frontend/src/components/ui/css-vars.test.ts
@@ -36,9 +36,6 @@ function load(file: string): string {
}
function blockBetween(css: string, openSelector: string): string {
- // Naive but sufficient: find the selector, then capture from there to the
- // matching closing brace of its top-level block. The :root and .dark blocks
- // in our index.css files are flat (no nested rules), so this is safe.
const idx = css.indexOf(openSelector);
if (idx === -1) {
return "";
@@ -79,10 +76,6 @@ describe.each(CSS_FILES)("%s defines DS token vars", (file) => {
expect(dark).toMatch(/--ring:\s*[^;]+;/);
});
- // Status tokens — consumed by Card tone variants and any future
- // status-tinted surface. Required in BOTH :root and .dark of all 3
- // entrypoints so border-success/border-warning render the same color
- // regardless of which app loads.
it("defines --success under :root", () => {
expect(root).toMatch(/--success:\s*[^;]+;/);
});
@@ -109,10 +102,6 @@ describe.each(CSS_FILES)("%s defines DS token vars", (file) => {
});
describe("--ring is consistent across cloud/eval/src", () => {
- // Sub-pixel drift (4.9% vs 5%) shipped a long time ago and is the kind
- // of polish gap a leadership walkthrough would notice. Lock the
- // harmonization in test so a future copy-paste into one entrypoint
- // can't silently re-introduce the drift.
function ringValue(css: string, selector: string): string {
const block = blockBetween(css, selector);
const m = block.match(/--ring:\s*([^;]+);/);
diff --git a/skyvern-frontend/src/components/ui/input.test.tsx b/skyvern-frontend/src/components/ui/input.test.tsx
index 5938b3dc4..c72812735 100644
--- a/skyvern-frontend/src/components/ui/input.test.tsx
+++ b/skyvern-frontend/src/components/ui/input.test.tsx
@@ -2,9 +2,6 @@ import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { Input } from "./input";
-// Contract: <Input> must render with the design-system tokens that the cloud
-// app (and OSS app) configure via CSS vars. Locking the className contract
-// here so a future shadcn-style refactor can't silently drop the token wiring.
describe("Input — DS token contract", () => {
it("renders with border-input so the --input CSS var drives the border color", () => {
const html = renderToStaticMarkup(<Input />);
@@ -18,7 +15,6 @@ describe("Input — DS token contract", () => {
it("renders a single <input> element so existing form-libraries keep working", () => {
const html = renderToStaticMarkup(<Input placeholder="Search" />);
- // Single input, no extra wrapping div / span.
expect(html.match(/<input\b/g)?.length ?? 0).toBe(1);
expect(html).toContain('placeholder="Search"');
});
diff --git a/skyvern-frontend/src/components/ui/sheet.tsx b/skyvern-frontend/src/components/ui/sheet.tsx
new file mode 100644
index 000000000..846cd9e07
--- /dev/null
+++ b/skyvern-frontend/src/components/ui/sheet.tsx
@@ -0,0 +1,183 @@
+import * as React from "react";
+import * as SheetPrimitive from "@radix-ui/react-dialog";
+import { Cross2Icon } from "@radix-ui/react-icons";
+import { cva, type VariantProps } from "class-variance-authority";
+
+import { cn } from "@/util/utils";
+
+const Sheet = SheetPrimitive.Root;
+
+const SheetTrigger = SheetPrimitive.Trigger;
+
+const SheetClose = SheetPrimitive.Close;
+
+const SheetPortal = SheetPrimitive.Portal;
+
+const SheetOverlay = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Overlay>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Overlay
+ ref={ref}
+ className={cn(
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ className,
+ )}
+ {...props}
+ />
+));
+SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
+
+const sheetVariants = cva(
+ "fixed z-50 flex flex-col bg-background shadow-lg outline-none transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
+ {
+ variants: {
+ side: {
+ right:
+ "inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
+ left: "inset-y-0 left-0 h-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
+ },
+ size: {
+ // Default (md) and lg map to the dashboard drill-through spec; sm
+ // exists for future narrow-rail use cases (e.g. notification feeds).
+ sm: "w-full sm:max-w-[360px]",
+ md: "w-full sm:max-w-[480px] lg:max-w-[600px]",
+ lg: "w-full sm:max-w-[600px] lg:max-w-[720px]",
+ },
+ },
+ defaultVariants: {
+ side: "right",
+ size: "md",
+ },
+ },
+);
+
+interface SheetContentProps
+ extends
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
+ VariantProps<typeof sheetVariants> {
+ /**
+ * When true, suppresses the default top-right Close icon button. Useful when
+ * a consumer wants full custom header chrome.
+ */
+ hideCloseButton?: boolean;
+}
+
+const SheetContent = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Content>,
+ SheetContentProps
+>(
+ (
+ { className, children, side, size, hideCloseButton = false, ...props },
+ ref,
+ ) => (
+ <SheetPortal>
+ <SheetOverlay />
+ <SheetPrimitive.Content
+ ref={ref}
+ className={cn(sheetVariants({ side, size }), className)}
+ {...props}
+ >
+ {children}
+ {hideCloseButton ? null : (
+ <SheetPrimitive.Close
+ className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none"
+ aria-label="Close"
+ >
+ <Cross2Icon className="h-4 w-4" aria-hidden="true" />
+ <span className="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ )}
+ </SheetPrimitive.Content>
+ </SheetPortal>
+ ),
+);
+SheetContent.displayName = SheetPrimitive.Content.displayName;
+
+// Header and Footer are pinned (do not scroll); Body is the scrollable region.
+// Consumers compose their drawer as Header → Body → Footer so the spec's
+// "header should NOT scroll; body scrolls" requirement falls out of the
+// layout rather than relying on per-consumer overflow tweaks.
+const SheetHeader = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-shrink-0 flex-col gap-1.5 border-b px-6 py-4",
+ className,
+ )}
+ {...props}
+ />
+);
+SheetHeader.displayName = "SheetHeader";
+
+const SheetBody = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-1 flex-col gap-4 overflow-y-auto px-6 py-4",
+ className,
+ )}
+ {...props}
+ />
+);
+SheetBody.displayName = "SheetBody";
+
+const SheetFooter = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-shrink-0 flex-col-reverse gap-2 border-t px-6 py-4 sm:flex-row sm:justify-end sm:gap-2",
+ className,
+ )}
+ {...props}
+ />
+);
+SheetFooter.displayName = "SheetFooter";
+
+const SheetTitle = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Title>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Title
+ ref={ref}
+ className={cn(
+ "text-lg font-semibold leading-none tracking-tight text-foreground",
+ className,
+ )}
+ {...props}
+ />
+));
+SheetTitle.displayName = SheetPrimitive.Title.displayName;
+
+const SheetDescription = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Description>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Description
+ ref={ref}
+ className={cn("text-sm text-muted-foreground", className)}
+ {...props}
+ />
+));
+SheetDescription.displayName = SheetPrimitive.Description.displayName;
+
+export {
+ Sheet,
+ SheetTrigger,
+ SheetClose,
+ SheetPortal,
+ SheetOverlay,
+ SheetContent,
+ SheetHeader,
+ SheetBody,
+ SheetFooter,
+ SheetTitle,
+ SheetDescription,
+};
+export type { SheetContentProps };
diff --git a/skyvern-frontend/src/components/ui/skeleton-variants.test.ts b/skyvern-frontend/src/components/ui/skeleton-variants.test.ts
index 942be411b..4929337d1 100644
--- a/skyvern-frontend/src/components/ui/skeleton-variants.test.ts
+++ b/skyvern-frontend/src/components/ui/skeleton-variants.test.ts
@@ -3,8 +3,6 @@ import { skeletonVariants } from "./skeleton-variants";
describe("skeletonVariants", () => {
it("returns the legacy class string for variant=rect", () => {
- // The pre-cva Skeleton was a single div with these classes. The rect
- // variant must emit them so existing callers see no visual change.
const result = skeletonVariants({ variant: "rect" });
expect(result).toContain("animate-pulse");
expect(result).toContain("rounded-md");
@@ -16,9 +14,6 @@ describe("skeletonVariants", () => {
});
it("emits rounded-full for circle so twMerge collapses rounded-md", () => {
- // Both classes end up in the final string; tailwind-merge collapses to
- // rounded-full at render time. Asserting rounded-full presence is enough
- // — no need to assert rounded-md absence.
expect(skeletonVariants({ variant: "circle" })).toContain("rounded-full");
});
diff --git a/skyvern-frontend/src/components/ui/skeleton-variants.ts b/skyvern-frontend/src/components/ui/skeleton-variants.ts
index 2fd839ec5..2b247f4f6 100644
--- a/skyvern-frontend/src/components/ui/skeleton-variants.ts
+++ b/skyvern-frontend/src/components/ui/skeleton-variants.ts
@@ -5,9 +5,7 @@ const skeletonVariants = cva("animate-pulse rounded-md bg-primary/10", {
variants: {
variant: {
rect: "",
- // tailwind-merge collapses rounded-md (base) → rounded-full (variant).
circle: "rounded-full",
- // Container only — line bars are rendered as children by the component.
text: "flex flex-col gap-2 bg-transparent rounded-none animate-none",
},
},
diff --git a/skyvern-frontend/src/components/ui/skeleton.test.tsx b/skyvern-frontend/src/components/ui/skeleton.test.tsx
index 79f3a0f61..4d86bdf9f 100644
--- a/skyvern-frontend/src/components/ui/skeleton.test.tsx
+++ b/skyvern-frontend/src/components/ui/skeleton.test.tsx
@@ -2,25 +2,16 @@ import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { Skeleton } from "./skeleton";
-// Existing-caller preservation gate: the 3 specialized callsites
-// (TaskListSkeletonRows, RunningTaskSkeleton, WorkflowRunOverviewSkeleton)
-// pass `<Skeleton className="..." />` with no variant prop. The rendered
-// HTML must keep the legacy single-<div> shape and the legacy core classes.
describe("Skeleton — existing-caller preservation", () => {
it("renders a single div carrying the className passthrough", () => {
const html = renderToStaticMarkup(<Skeleton className="h-4 w-full" />);
expect(html).toMatch(/^<div\b/);
expect(html).toContain("h-4");
expect(html).toContain("w-full");
- // Legacy core classes — the rect default must keep emitting these.
expect(html).toContain("animate-pulse");
expect(html).toContain("rounded-md");
});
- // PRESERVATION HARD GATE — no-prop default must render byte-identical HTML
- // to the pre-cva Skeleton. Cascade rebase relies on this; if this test
- // breaks, downstream PRs that style around <Skeleton> may surface visual
- // regressions. Don't relax this assertion without sc-67 sign-off.
it('matches `<Skeleton variant="rect" />` exactly when no variant prop is passed', () => {
const noProp = renderToStaticMarkup(<Skeleton className="h-4 w-full" />);
const explicit = renderToStaticMarkup(
@@ -34,7 +25,6 @@ describe("Skeleton — variant=circle", () => {
it("renders a round shape sized via inline style", () => {
const html = renderToStaticMarkup(<Skeleton variant="circle" size={32} />);
expect(html).toContain("rounded-full");
- // Inline width/height in pixels so callers can size without className.
expect(html).toContain("width:32px");
expect(html).toContain("height:32px");
});
@@ -43,7 +33,6 @@ describe("Skeleton — variant=circle", () => {
describe("Skeleton — variant=text", () => {
it("renders N stacked line divs (lines prop)", () => {
const html = renderToStaticMarkup(<Skeleton variant="text" lines={3} />);
- // Three internal line bars; outer container counts as the wrapper.
const lineMatches = html.match(/<div[^>]*data-skeleton-line/g) ?? [];
expect(lineMatches.length).toBe(3);
});
diff --git a/skyvern-frontend/src/components/ui/skeleton.tsx b/skyvern-frontend/src/components/ui/skeleton.tsx
index bb421d2c4..86257a81b 100644
--- a/skyvern-frontend/src/components/ui/skeleton.tsx
+++ b/skyvern-frontend/src/components/ui/skeleton.tsx
@@ -8,9 +8,7 @@ type SkeletonBaseProps = React.HTMLAttributes<HTMLDivElement> &
VariantProps<typeof skeletonVariants>;
interface SkeletonProps extends SkeletonBaseProps {
- // circle: render a round placeholder sized to `size` (px). Defaults to 24.
size?: number;
- // text: number of stacked line bars to render. Defaults to 1.
lines?: number;
}
@@ -45,8 +43,6 @@ function Skeleton({
<div
key={i}
data-skeleton-line=""
- // Last line is shorter so the stack reads as text rather than a
- // uniform block; matches common skeleton conventions.
className={cn(
"h-4 animate-pulse rounded-md bg-primary/10",
i === lineCount - 1 && lineCount > 1 ? "w-2/3" : "w-full",
@@ -57,7 +53,6 @@ function Skeleton({
);
}
- // variant === "rect" or undefined (default).
return (
<div
className={cn(skeletonVariants({ variant }), className)}
diff --git a/skyvern-frontend/src/components/ui/table-variants.test.ts b/skyvern-frontend/src/components/ui/table-variants.test.ts
index 17276bd9a..40bd73175 100644
--- a/skyvern-frontend/src/components/ui/table-variants.test.ts
+++ b/skyvern-frontend/src/components/ui/table-variants.test.ts
@@ -2,10 +2,6 @@ import { describe, expect, it } from "vitest";
import { tableVariants } from "./table-variants";
describe("tableVariants", () => {
- // Pre-cva Table class string was:
- // "w-full caption-bottom text-sm"
- // The default variant must emit those classes so existing Table callers
- // (many — Table is a workhorse) render byte-identical output.
it("returns the legacy class set for variant=default (existing-caller preservation)", () => {
const result = tableVariants({ variant: "default" });
expect(result).toContain("w-full");
@@ -18,8 +14,6 @@ describe("tableVariants", () => {
});
it("does not inject column-width selectors on the default variant", () => {
- // The line-5col selectors must NOT bleed into the default variant —
- // existing callers don't expect their TableCell to be auto-aligned.
const result = tableVariants({ variant: "default" });
expect(result).not.toMatch(/nth-child/);
expect(result).not.toMatch(/tabular-nums/);
@@ -44,7 +38,6 @@ describe("tableVariants", () => {
});
it("sets fixed widths on cols 2-5 so col 1 (workflow) takes the remaining space", () => {
- // Runs col is narrower (80px / w-20) than the cost cols (w-24).
expect(result).toMatch(/\[&_th:nth-child\(2\)\]:w-20/);
expect(result).toMatch(/\[&_th:nth-child\(3\)\]:w-24/);
expect(result).toMatch(/\[&_th:nth-child\(4\)\]:w-24/);
diff --git a/skyvern-frontend/src/components/ui/table-variants.ts b/skyvern-frontend/src/components/ui/table-variants.ts
index 6921684b7..c6b71bfd8 100644
--- a/skyvern-frontend/src/components/ui/table-variants.ts
+++ b/skyvern-frontend/src/components/ui/table-variants.ts
@@ -6,21 +6,13 @@ const tableVariants = cva("w-full caption-bottom text-sm", {
variant: {
default: "",
"line-5col": [
- // Right-align cols 2-5 (Runs, Success%, Avg Cost, Total Cost).
- // Col 1 (Workflow) keeps the default left alignment.
"[&_th:nth-child(n+2)]:text-right",
"[&_td:nth-child(n+2)]:text-right",
- // Tabular-nums on numeric cells so 1,234 lines up under 12,345.
"[&_td:nth-child(n+2)]:tabular-nums",
- // Fixed widths: Runs is narrower (80px) than the cost cols (96px).
- // Workflow col (1) absorbs the remaining width via the default
- // `w-auto` behavior of <th>.
"[&_th:nth-child(2)]:w-20",
"[&_th:nth-child(3)]:w-24",
"[&_th:nth-child(4)]:w-24",
"[&_th:nth-child(5)]:w-24",
- // Total Cost is the bottom-line number — bold so the eye lands
- // there first when scanning the breakdown.
"[&_td:nth-child(5)]:font-semibold",
].join(" "),
},
diff --git a/skyvern-frontend/src/components/ui/typography.test.tsx b/skyvern-frontend/src/components/ui/typography.test.tsx
index fd9c74860..849dd6e07 100644
--- a/skyvern-frontend/src/components/ui/typography.test.tsx
+++ b/skyvern-frontend/src/components/ui/typography.test.tsx
@@ -8,8 +8,6 @@ describe("TitleDescription", () => {
<TitleDescription title="Usage & Operations" />,
);
expect(html).toContain("Usage &amp; Operations");
- // Default heading level is h2 — recognized by both screen readers and
- // the DS visual scale. Override via `as` if the page already has an h1.
expect(html).toMatch(/<h2\b/);
});
@@ -25,8 +23,6 @@ describe("TitleDescription", () => {
});
it("omits the description <p> entirely when description is undefined", () => {
- // No empty paragraph — the screen reader / visual rhythm should not
- // pick up a phantom slot.
const html = renderToStaticMarkup(
<TitleDescription title="Just a title" />,
);
@@ -41,9 +37,6 @@ describe("TitleDescription", () => {
});
it("respects the `as` prop to override the default heading level", () => {
- // Page-level header consumers (e.g. /analytics page) already have an
- // <h1> from the route layout; they want this primitive to render <h2>
- // by default but be able to drop to <h3> for sub-section headers.
const html = renderToStaticMarkup(
<TitleDescription as="h3" title="Sub-section" />,
);
diff --git a/skyvern-frontend/src/routes/history/RunHistory.tsx b/skyvern-frontend/src/routes/history/RunHistory.tsx
index 59e1adf51..f582e6514 100644
--- a/skyvern-frontend/src/routes/history/RunHistory.tsx
+++ b/skyvern-frontend/src/routes/history/RunHistory.tsx
@@ -47,7 +47,7 @@ import {
} from "@/util/timeFormat";
import { cn } from "@/util/utils";
import { useQuery } from "@tanstack/react-query";
-import React, { useEffect, useState } from "react";
+import React, { useEffect, useMemo, useState } from "react";
import { useNavigate, useSearchParams } from "react-router-dom";
import { getClient } from "@/api/AxiosClient";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
@@ -71,6 +71,23 @@ function isKnownStatus(value: string): value is Status {
return statusValues.has(value);
}
+function parseStatusParam(raw: string | null): Array<Status> {
+ if (!raw) {
+ return [];
+ }
+ const seen = new Set<Status>();
+ const out: Array<Status> = [];
+ for (const token of raw.split(",")) {
+ const trimmed = token.trim();
+ if (trimmed === "" || !isKnownStatus(trimmed) || seen.has(trimmed)) {
+ continue;
+ }
+ seen.add(trimmed);
+ out.push(trimmed);
+ }
+ return out;
+}
+
// Scheduled workflow runs carry a deterministic `wr_sched_<hash>` id prefix.
function inferTriggerType(run: TaskRunListItem): TriggerType | null {
if (
@@ -103,26 +120,56 @@ function RunHistory() {
const itemsPerPage = searchParams.get("page_size")
? Number(searchParams.get("page_size"))
: 10;
- const [statusFilters, setStatusFilters] = useState<Array<Status>>([]);
+ const workflowPermanentIdFilter = searchParams.get("workflow_permanent_id");
+ const statusFilters = useMemo(
+ () => parseStatusParam(searchParams.get("status")),
+ [searchParams],
+ );
const [search, setSearch] = useState("");
const [debouncedSearch] = useDebounce(search, 500);
- const { data: runs, isFetching } = useRunsQuery({
+ const effectiveSearch = workflowPermanentIdFilter || debouncedSearch;
+
+ const { data: rawRuns, isFetching } = useRunsQuery({
page,
pageSize: itemsPerPage,
statusFilters,
- search: debouncedSearch,
+ search: effectiveSearch,
});
const navigate = useNavigate();
- const { data: nextPageRuns } = useRunsQuery({
+ const { data: rawNextPageRuns } = useRunsQuery({
page: page + 1,
pageSize: itemsPerPage,
statusFilters,
- search: debouncedSearch,
- enabled: runs?.length === itemsPerPage,
+ search: effectiveSearch,
+ enabled: rawRuns?.length === itemsPerPage,
});
+ // /runs treats `search` as a substring match across searchable_text,
+ // run_id, and workflow_permanent_id. When the user is filtering by a
+ // specific workflow_permanent_id we tighten the result client-side so
+ // unrelated runs whose text shares a substring with this id don't bleed in.
+ // Pagination becomes best-effort under this filter — pages may be shorter
+ // than itemsPerPage when matches are sparse.
+ const runs = useMemo(() => {
+ if (!rawRuns || !workflowPermanentIdFilter) {
+ return rawRuns;
+ }
+ return rawRuns.filter(
+ (run) => run.workflow_permanent_id === workflowPermanentIdFilter,
+ );
+ }, [rawRuns, workflowPermanentIdFilter]);
+
+ const nextPageRuns = useMemo(() => {
+ if (!rawNextPageRuns || !workflowPermanentIdFilter) {
+ return rawNextPageRuns;
+ }
+ return rawNextPageRuns.filter(
+ (run) => run.workflow_permanent_id === workflowPermanentIdFilter,
+ );
+ }, [rawNextPageRuns, workflowPermanentIdFilter]);
+
const isNextDisabled =
isFetching || !nextPageRuns || nextPageRuns.length === 0;
@@ -318,11 +365,37 @@ function RunHistory() {
});
};
+ function clearWorkflowFilter() {
+ const params = new URLSearchParams(searchParams);
+ params.delete("workflow_permanent_id");
+ params.set("page", "1");
+ setSearchParams(params, { replace: true });
+ }
+
return (
<div className="space-y-4">
<header>
<h1 className="text-2xl">Run History</h1>
</header>
+ {workflowPermanentIdFilter ? (
+ <div
+ className="flex items-center justify-between gap-2 rounded-md border border-dashed bg-muted/30 px-3 py-2 text-xs"
+ data-testid="workflow-filter-banner"
+ >
+ <span className="truncate">
+ Filtering runs for workflow{" "}
+ <span className="font-mono">{workflowPermanentIdFilter}</span>
+ </span>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={clearWorkflowFilter}
+ className="h-auto py-1 text-xs"
+ >
+ Clear
+ </Button>
+ </div>
+ ) : null}
<div className="flex items-center justify-between gap-4">
<TableSearchInput
value={search}
@@ -332,14 +405,23 @@ function RunHistory() {
params.set("page", "1");
setSearchParams(params, { replace: true });
}}
- placeholder="Search by run ID or parameter..."
+ placeholder={
+ workflowPermanentIdFilter
+ ? "Clear the workflow filter above to search"
+ : "Search by run ID or parameter..."
+ }
+ disabled={!!workflowPermanentIdFilter}
className="w-48 lg:w-72"
/>
<StatusFilterDropdown
values={statusFilters}
onChange={(filters) => {
- setStatusFilters(filters);
const params = new URLSearchParams(searchParams);
+ if (filters.length === 0) {
+ params.delete("status");
+ } else {
+ params.set("status", filters.join(","));
+ }
params.set("page", "1");
setSearchParams(params, { replace: true });
}}
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx
index e4ec1265a..7f02e9600 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowPage.tsx
@@ -1,4 +1,5 @@
import {
+ BarChartIcon,
LightningBoltIcon,
CodeIcon,
MixerHorizontalIcon,
@@ -41,7 +42,8 @@ import {
formatExecutionTime,
} from "@/util/timeFormat";
import { cn } from "@/util/utils";
-import React, { useEffect, useState } from "react";
+import CloudContext from "@/store/CloudContext";
+import React, { useContext, useEffect, useState } from "react";
import {
Link,
useNavigate,
@@ -69,9 +71,11 @@ import { useKeywordSearch } from "./hooks/useKeywordSearch";
import { useParameterExpansion } from "./hooks/useParameterExpansion";
import { ParameterDisplayInline } from "./components/ParameterDisplayInline";
import { getOrderedRunParameters } from "./utils";
+import { buildWorkflowAnalyticsPath } from "./workflowAnalyticsPath";
function WorkflowPage() {
const { workflowPermanentId } = useParams();
+ const isCloud = useContext(CloudContext);
const [searchParams, setSearchParams] = useSearchParams();
const page = searchParams.get("page") ? Number(searchParams.get("page")) : 1;
const [statusFilters, setStatusFilters] = useState<Array<Status>>([]);
@@ -152,6 +156,14 @@ function WorkflowPage() {
onSuccessfullyDeleted={() => navigate("/workflows")}
/>
)}
+ {isCloud ? (
+ <Button asChild variant="secondary">
+ <Link to={buildWorkflowAnalyticsPath(workflowPermanentId)}>
+ <BarChartIcon className="mr-2 size-4" />
+ Analytics
+ </Link>
+ </Button>
+ ) : null}
<Button asChild variant="secondary">
<Link to={`/workflows/${workflowPermanentId}/scripts`}>
<CodeIcon className="mr-2 size-4" />
diff --git a/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.test.ts b/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.test.ts
new file mode 100644
index 000000000..f1a44f858
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from "vitest";
+
+import { buildWorkflowAnalyticsPath } from "./workflowAnalyticsPath";
+
+describe("buildWorkflowAnalyticsPath", () => {
+ it("links analytics to the workflow comparison selection", () => {
+ expect(buildWorkflowAnalyticsPath("wpid_abc123")).toBe(
+ "/analytics?compare=wpid_abc123",
+ );
+ });
+
+ it("URL-encodes workflow ids before adding them to the query string", () => {
+ expect(buildWorkflowAnalyticsPath("wpid space")).toBe(
+ "/analytics?compare=wpid+space",
+ );
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.ts b/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.ts
new file mode 100644
index 000000000..382a75935
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/workflowAnalyticsPath.ts
@@ -0,0 +1,7 @@
+function buildWorkflowAnalyticsPath(workflowPermanentId: string): string {
+ const params = new URLSearchParams();
+ params.set("compare", workflowPermanentId);
+ return `/analytics?${params.toString()}`;
+}
+
+export { buildWorkflowAnalyticsPath };
diff --git a/skyvern-frontend/src/util/dashboardLoadStateActive.ts b/skyvern-frontend/src/util/dashboardLoadStateActive.ts
new file mode 100644
index 000000000..0bfae802f
--- /dev/null
+++ b/skyvern-frontend/src/util/dashboardLoadStateActive.ts
@@ -0,0 +1,14 @@
+// own file so dashboard-load-state.tsx only exports a component (react-refresh/only-export-components)
+function isDashboardLoadStateActive({
+ isLoading,
+ isError,
+ isEmpty,
+}: {
+ isLoading: boolean;
+ isError: boolean;
+ isEmpty: boolean;
+}): boolean {
+ return isLoading || isError || isEmpty;
+}
+
+export { isDashboardLoadStateActive };
diff --git a/skyvern-frontend/vitest.config.ts b/skyvern-frontend/vitest.config.ts
index 000083fa3..f3404bb8e 100644
--- a/skyvern-frontend/vitest.config.ts
+++ b/skyvern-frontend/vitest.config.ts
@@ -10,6 +10,8 @@ export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
+ "@cloud": path.resolve(__dirname, "./cloud"),
+ "@eval": path.resolve(__dirname, "./eval"),
},
},
});