mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 15:29:10 +00:00
419ca5c4ca
A lifecycle was written three ways depending on where you were standing: "On Start" in the automation settings, the raw "onStart" in the event editor, and again as a literal in the trigger list. Anyone attaching an automation to an event had to work out that the two lists were the same list. One label map now owns the user facing names, and one helper summarises what an automation sends. Both are shared, so the event editor gains the labels and a Sends column for free: the trigger row says which automation runs and what it will do, instead of only its title. Two things the panel could not say before, now that it can look them up: - A trigger can outlive the automation it points at, say after a partial project import. It rendered as an empty tag; it now says so. - not_contains is in the type and the runtime, but the server validation list omits it, so an automation using it cannot be saved. The operator list moves out of the form and drops it, with a test to stop it coming back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AfDKsy6PE3Rbyt32Fg4YKf
26 lines
908 B
TypeScript
26 lines
908 B
TypeScript
import { TimerLifeCycle } from 'ontime-types';
|
|
|
|
/**
|
|
* User facing labels for the timer lifecycle
|
|
* Shared between the automation settings and the rundown event editor
|
|
* so that a lifecycle is named the same everywhere it is shown
|
|
*/
|
|
export const lifecycleLabels: Record<TimerLifeCycle, string> = {
|
|
[TimerLifeCycle.onLoad]: 'On Load',
|
|
[TimerLifeCycle.onStart]: 'On Start',
|
|
[TimerLifeCycle.onPause]: 'On Pause',
|
|
[TimerLifeCycle.onStop]: 'On Stop',
|
|
[TimerLifeCycle.onClock]: 'Every second',
|
|
[TimerLifeCycle.onUpdate]: 'On Timer Update',
|
|
[TimerLifeCycle.onFinish]: 'On Finish',
|
|
[TimerLifeCycle.onWarning]: 'On Warning',
|
|
[TimerLifeCycle.onDanger]: 'On Danger',
|
|
};
|
|
|
|
/**
|
|
* Resolves a lifecycle to its user facing label, falling back to the raw value
|
|
*/
|
|
export function getLifecycleLabel(cycle: TimerLifeCycle | string): string {
|
|
return lifecycleLabels[cycle as TimerLifeCycle] ?? cycle;
|
|
}
|