Act on a run, and read Home top-down
Runs: a run can now be deleted (DELETE /runs/{id}, cancelling a live one
first), exported as csv from the screen's own filters, and its flow label
opens the flow. Its "Parameters" panel became "Inputs" and lists every
input the flow declares, marking the ones that took the flow's own value
rather than the run's — the comparison table resolves the same defaults
instead of printing "unset".
Home reads brain, dashboards, health, flows: the mosaic is one full-width
scrolling strip, and the flows list and the flow-activity rollups merged
into a single left-joined table so a flow's state and its numbers sit on
one row.
Charts take a drag to narrow the x window and a double click or tap to
come back out. UplotChart holds the scale and passes resetScales:false
while a window is held, which is what the old comment said made this
impossible.
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
shortCommit,
|
||||
shortId,
|
||||
useCancelRun,
|
||||
useFlowInputs,
|
||||
} from "./queries"
|
||||
import { NodeStatusBadge, RunStatusBadge, statusReason } from "./RunStatus"
|
||||
|
||||
@@ -39,6 +40,7 @@ export function RunDetail({ id }: { id: string }) {
|
||||
const { data: run, isPending } = useQuery(runQueryOptions(id))
|
||||
const cancel = useCancelRun()
|
||||
const names = useMetricNames(id)
|
||||
const declared = useFlowInputs(run?.flow)
|
||||
const [metric, setMetric] = useState("")
|
||||
|
||||
if (isPending || !run) return <Skeleton className="h-96 w-full rounded-lg" />
|
||||
@@ -52,6 +54,20 @@ export function RunDetail({ id }: { id: string }) {
|
||||
// Said once, where it applies.
|
||||
const cached = nodes.some((node) => node.status === "cached")
|
||||
|
||||
// Declared order first, so the panel reads the way the flow does; anything
|
||||
// the run carries that the flow no longer declares still shows, since it is
|
||||
// what the run was actually given.
|
||||
const fed = [
|
||||
...[...declared.keys()].map((name) => ({
|
||||
name,
|
||||
value: name in run.params ? run.params[name] : declared.get(name),
|
||||
fromFlow: !(name in run.params),
|
||||
})),
|
||||
...Object.keys(run.params)
|
||||
.filter((name) => !declared.has(name))
|
||||
.map((name) => ({ name, value: run.params[name], fromFlow: false })),
|
||||
]
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<header className="flex flex-wrap items-center gap-3">
|
||||
@@ -113,16 +129,26 @@ export function RunDetail({ id }: { id: string }) {
|
||||
</Fact>
|
||||
</section>
|
||||
|
||||
{/* What the run actually ran with, which is not the same list as what it
|
||||
was passed: a flow's inputs *are* its parameters, and one left alone
|
||||
took the flow's own value. Both are drawn, and which is which is
|
||||
marked — reading a number off a chart is worth nothing if the other
|
||||
half of the setting is invisible. */}
|
||||
<section className={cn(CARD, "flex flex-col gap-2")}>
|
||||
<h2 className="font-medium text-sm">Parameters</h2>
|
||||
{Object.keys(run.params).length === 0 ? (
|
||||
<h2 className="font-medium text-sm">Inputs</h2>
|
||||
{fed.length === 0 ? (
|
||||
<p className="text-muted-foreground text-sm">
|
||||
This run took its flow's own defaults.
|
||||
This flow declares no inputs, so there was nothing to choose.
|
||||
</p>
|
||||
) : (
|
||||
<dl className="grid gap-x-6 gap-y-1 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{Object.entries(run.params).map(([key, value]) => (
|
||||
<Entry key={key} name={key} value={value} />
|
||||
{fed.map(({ name, value, fromFlow }) => (
|
||||
<Entry
|
||||
key={name}
|
||||
name={name}
|
||||
value={value}
|
||||
note={fromFlow ? "default" : undefined}
|
||||
/>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
@@ -167,7 +193,16 @@ export function RunDetail({ id }: { id: string }) {
|
||||
* record like any other, and serialising it onto one truncated line answers
|
||||
* nothing.
|
||||
*/
|
||||
function Entry({ name, value }: { name: string; value: unknown }) {
|
||||
function Entry({
|
||||
name,
|
||||
value,
|
||||
note,
|
||||
}: {
|
||||
name: string
|
||||
value: unknown
|
||||
/** Where the value came from, when it was not this run. */
|
||||
note?: string
|
||||
}) {
|
||||
const structured = value !== null && typeof value === "object"
|
||||
return (
|
||||
<div
|
||||
@@ -176,7 +211,14 @@ function Entry({ name, value }: { name: string; value: unknown }) {
|
||||
structured ? "flex flex-col" : "flex justify-between",
|
||||
)}
|
||||
>
|
||||
<dt className={LABEL}>{name}</dt>
|
||||
<dt className={cn(LABEL, "flex items-baseline gap-1.5")}>
|
||||
{name}
|
||||
{note && (
|
||||
<span className="rounded-full border border-border px-1.5 text-[10px]">
|
||||
{note}
|
||||
</span>
|
||||
)}
|
||||
</dt>
|
||||
<dd
|
||||
className={cn(
|
||||
"min-w-0",
|
||||
|
||||
Reference in New Issue
Block a user