diff --git a/ui-react/src/pages/modeling/thread/MintRuns.tsx b/ui-react/src/pages/modeling/thread/MintRuns.tsx index 84993e1d..60090704 100644 --- a/ui-react/src/pages/modeling/thread/MintRuns.tsx +++ b/ui-react/src/pages/modeling/thread/MintRuns.tsx @@ -1049,6 +1049,87 @@ interface MintRunsProps { const PAGE_SIZE = 100; +interface RunParam { + id?: string | null; + name?: string | null; + default?: string | null; +} + +function humanizeName(name?: string | null): string { + return (name ?? '').replace(/[-_]/g, ' '); +} + +/** The value a run shows for a parameter: its binding, else the default. */ +function runParamValue(param: RunParam, execution: Execution): string { + let value = execution.bindings[param.id ?? ''] as unknown; + if (value == null) value = param.default ?? null; + if (typeof value === 'string' && value.startsWith('__region_geojson')) { + return 'Region GeoJSON'; + } + if (value == null || value === '') return '—'; + return String(value); +} + +/** + * Split parameters into those that tell the listed runs apart (they get a + * column) and those every run shares (they are summarised above the table). + */ +function splitRunParams
( + params: P[], + executions: Execution[], +): { varying: P[]; common: Array<{ param: P; value: string }> } { + const varying: P[] = []; + const common: Array<{ param: P; value: string }> = []; + for (const param of params) { + const values = new Set(executions.map((e) => runParamValue(param, e))); + if (values.size > 1) { + varying.push(param); + } else { + const value = executions[0] ? runParamValue(param, executions[0]) : '—'; + if (value !== '—') common.push({ param, value }); + } + } + return { varying, common }; +} + +const SAME_FOR_EVERY_RUN_LIMIT = 6; + +function SameForEveryRun({ + items, + testId, +}: { + items: Array<{ param: RunParam; value: string }>; + testId: string; +}) { + const [showAll, setShowAll] = useState(false); + if (items.length === 0) return null; + const truncated = items.length > SAME_FOR_EVERY_RUN_LIMIT && !showAll; + const shown = truncated ? items.slice(0, SAME_FOR_EVERY_RUN_LIMIT) : items; + return ( +
+ Same for every run:{' '} + {shown.map(({ param, value }, i) => ( + + {i > 0 && ' · '} + {humanizeName(param.name)} {value} + + ))} + {items.length > SAME_FOR_EVERY_RUN_LIMIT && ( + <> + {' '} + + > + )} +
+ ); +} + export function MintRuns({ threadId, threadData, @@ -1351,7 +1432,11 @@ export function MintRuns({ // ── adjustable inputs / params for column headers ───────────── const adjustableInputs = model.input_files.filter((f) => !f.value); - const adjustableParams = userParameters(model).filter((p) => !p.value); + const settableParams = userParameters(model).filter((p) => !p.value); + const { varying: adjustableParams, common: sameParams } = splitRunParams( + settableParams, + grouped.executions, + ); return (