feat(automations): forward live status and steps to run details panel

This commit is contained in:
CREDO23 2026-06-01 21:02:47 +02:00
parent 69eb64db08
commit d8db3159d6

View file

@ -1,21 +1,21 @@
"use client"; "use client";
import { ChevronDown, ChevronRight, Hand } from "lucide-react"; import { ChevronDown, ChevronRight, Hand } from "lucide-react";
import { useState } from "react"; import { useState } from "react";
import type { RunSummary } from "@/contracts/types/automation.types"; import type { LiveRunSummary } from "@/hooks/use-automation-runs";
import { formatDuration } from "@/lib/automations/run-duration"; import { formatDuration } from "@/lib/automations/run-duration";
import { formatRelativeDate } from "@/lib/format-date"; import { formatRelativeDate } from "@/lib/format-date";
import { RunDetailsPanel } from "./run-details-panel"; import { RunDetailsPanel } from "./run-details-panel";
import { RunStatusBadge } from "./run-status-badge"; import { RunStatusBadge } from "./run-status-badge";
interface RunRowProps { interface RunRowProps {
run: RunSummary; run: LiveRunSummary;
automationId: number; automationId: number;
} }
/** /**
* One run row. Click to expand fetches the full run and shows the * One run row. Click to expand renders the details panel inline.
* details panel inline. State is local to each row so multiple panels * Status and step_results come live from the parent's Zero query; the
* can be open at once (or none). * panel itself only fetches the heavy REST fields on first expand.
*/ */
export function RunRow({ run, automationId }: RunRowProps) { export function RunRow({ run, automationId }: RunRowProps) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -47,7 +47,14 @@ export function RunRow({ run, automationId }: RunRowProps) {
</div> </div>
</button> </button>
{open && <RunDetailsPanel automationId={automationId} runId={run.id} />} {open && (
<RunDetailsPanel
automationId={automationId}
runId={run.id}
liveSteps={run.step_results}
liveStatus={run.status}
/>
)}
</div> </div>
); );
} }