mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 03:13:47 +00:00
0f9e436576
The list showed counts rather than meaning, and one column was mislabelled "Trigger rule" while rendering the filter rule. The form buried the test and delete actions inside four fixed grids, and the Test buttons discarded their result entirely, so a failing output looked identical to a working one. - list rows now say when an automation runs, what it sends, and flag the two silent misconfigurations: an automation with no triggers and one with no outputs - outputs and filters render as cards with a shared header, replacing the fixed grids and the spacer hack used to fake a label-height cell - test results are reported inline, keyed by field array id so removing an output cannot leave feedback on the wrong row - filters gain a plain language summary, and the filter rule only shows when there is more than one filter to combine - lifecycle labels are shared with the rundown event editor, which was showing raw enum values, and it now shows what the linked automation sends - triggers pointing at a deleted automation say so instead of rendering an empty tag; the duplicates warning describes what actually happens not_contains stays out of the operator list: the type and the runtime support it but the server validation list omits it, so it cannot be saved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LpbLJVVT26tzWkduck1M9H
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { AutomationOutput } from 'ontime-types';
|
|
|
|
const outputLabels: Record<AutomationOutput['type'], string> = {
|
|
osc: 'OSC',
|
|
http: 'HTTP',
|
|
ontime: 'Ontime',
|
|
};
|
|
|
|
export type OutputSummary = {
|
|
type: AutomationOutput['type'];
|
|
label: string;
|
|
count: number;
|
|
};
|
|
|
|
/**
|
|
* Summarises an automation's outputs by kind so that a list row can say what the
|
|
* automation does without the user having to open the form.
|
|
* Shared between the automation settings panel and the rundown event editor.
|
|
*/
|
|
export function summariseOutputs(outputs: AutomationOutput[]): OutputSummary[] {
|
|
const counts = new Map<AutomationOutput['type'], number>();
|
|
|
|
for (const output of outputs) {
|
|
counts.set(output.type, (counts.get(output.type) ?? 0) + 1);
|
|
}
|
|
|
|
// keep a stable presentation order regardless of the order the user added outputs
|
|
const order: AutomationOutput['type'][] = ['osc', 'http', 'ontime'];
|
|
return order
|
|
.filter((type) => counts.has(type))
|
|
.map((type) => ({ type, label: outputLabels[type], count: counts.get(type) as number }));
|
|
}
|