Name the comparison's X and Y beside their pickers, not in every option
Docs / docs (push) Successful in 22s
Playwright Tests / test-playwright (1, 2) (push) Failing after 2m47s
Playwright Tests / test-playwright (2, 2) (push) Failing after 1m44s
pre-commit / pre-commit (push) Failing after 3m14s
Test Backend / test-backend (push) Successful in 2m24s
Compose Smoke Test / test-compose (push) Successful in 31s
Playwright Tests / merge-reports (push) Failing after 1m7s
Docs / docs (push) Successful in 22s
Playwright Tests / test-playwright (1, 2) (push) Failing after 2m47s
Playwright Tests / test-playwright (2, 2) (push) Failing after 1m44s
pre-commit / pre-commit (push) Failing after 3m14s
Test Backend / test-backend (push) Successful in 2m24s
Compose Smoke Test / test-compose (push) Successful in 31s
Playwright Tests / merge-reports (push) Failing after 1m7s
This commit is contained in:
@@ -83,20 +83,42 @@ export function RunMetricChart({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The axis a picker sets, written beside it rather than into every option.
|
||||||
|
*
|
||||||
|
* The dropdown then lists names — "step", "loss" — instead of repeating "vs"
|
||||||
|
* once per row, and which axis is being set is said once, where it belongs.
|
||||||
|
*/
|
||||||
|
function AxisLabel({ children }: { children: string }) {
|
||||||
|
return (
|
||||||
|
<span className="font-medium text-muted-foreground text-xs" aria-hidden>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** The metric picker both the detail and the comparison sit under. */
|
/** The metric picker both the detail and the comparison sit under. */
|
||||||
export function MetricPicker({
|
export function MetricPicker({
|
||||||
names,
|
names,
|
||||||
value,
|
value,
|
||||||
|
axis,
|
||||||
onChange,
|
onChange,
|
||||||
}: {
|
}: {
|
||||||
names: string[]
|
names: string[]
|
||||||
value: string
|
value: string
|
||||||
|
/** Named where the chart has an axis for it to be; bare on its own. */
|
||||||
|
axis?: string
|
||||||
onChange: (name: string) => void
|
onChange: (name: string) => void
|
||||||
}) {
|
}) {
|
||||||
if (names.length === 0) return null
|
if (names.length === 0) return null
|
||||||
return (
|
return (
|
||||||
|
<div className="flex items-center gap-1.5">
|
||||||
|
{axis && <AxisLabel>{axis}</AxisLabel>}
|
||||||
<Select value={value} onValueChange={onChange}>
|
<Select value={value} onValueChange={onChange}>
|
||||||
<SelectTrigger className="h-8 w-56" aria-label="Metric">
|
<SelectTrigger
|
||||||
|
className={cn("h-8", axis ? "w-52" : "w-56")}
|
||||||
|
aria-label={axis ? `${axis} axis` : "Metric"}
|
||||||
|
>
|
||||||
<SelectValue placeholder="Metric" />
|
<SelectValue placeholder="Metric" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@@ -107,37 +129,37 @@ export function MetricPicker({
|
|||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** What the comparison is plotted against. */
|
||||||
* What the comparison is plotted against.
|
|
||||||
*
|
|
||||||
* Doubles as the axis label — it sits directly above the chart, and naming the
|
|
||||||
* axis twice is one caption too many.
|
|
||||||
*/
|
|
||||||
export function AxisPicker({
|
export function AxisPicker({
|
||||||
names,
|
names,
|
||||||
metric,
|
metric,
|
||||||
value,
|
value,
|
||||||
|
axis = "X",
|
||||||
onChange,
|
onChange,
|
||||||
}: {
|
}: {
|
||||||
names: string[]
|
names: string[]
|
||||||
/** Excluded from the choices: a metric against itself is a straight line. */
|
/** Excluded from the choices: a metric against itself is a straight line. */
|
||||||
metric: string
|
metric: string
|
||||||
value: string
|
value: string
|
||||||
|
axis?: string
|
||||||
onChange: (x: string) => void
|
onChange: (x: string) => void
|
||||||
}) {
|
}) {
|
||||||
const options = [
|
const options = [
|
||||||
{ value: STEP_AXIS, label: "vs step" },
|
{ value: STEP_AXIS, label: "step" },
|
||||||
{ value: TIME_AXIS, label: "vs time (s)" },
|
{ value: TIME_AXIS, label: "time (s)" },
|
||||||
...names
|
...names
|
||||||
.filter((name) => name !== metric)
|
.filter((name) => name !== metric)
|
||||||
.map((name) => ({ value: name, label: `vs ${name}` })),
|
.map((name) => ({ value: name, label: name })),
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
|
<div className="flex items-center gap-1.5">
|
||||||
|
<AxisLabel>{axis}</AxisLabel>
|
||||||
<Select value={value} onValueChange={onChange}>
|
<Select value={value} onValueChange={onChange}>
|
||||||
<SelectTrigger className="h-8 w-44" aria-label="Plotted against">
|
<SelectTrigger className="h-8 w-44" aria-label={`${axis} axis`}>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@@ -148,5 +170,6 @@ export function AxisPicker({
|
|||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -500,6 +500,7 @@ function Compare({
|
|||||||
<MetricPicker
|
<MetricPicker
|
||||||
names={names}
|
names={names}
|
||||||
value={metric}
|
value={metric}
|
||||||
|
axis="Y"
|
||||||
onChange={(name) => update({ metric: name })}
|
onChange={(name) => update({ metric: name })}
|
||||||
/>
|
/>
|
||||||
{names.length > 0 && (
|
{names.length > 0 && (
|
||||||
|
|||||||
Reference in New Issue
Block a user