mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-14 18:43:09 +00:00
feat(automation): improve definition and trigger editing
This commit is contained in:
committed by
Carlos Valente
parent
79c21daf73
commit
b07544ab84
@@ -0,0 +1,13 @@
|
||||
import { TimerLifeCycle } from 'ontime-types';
|
||||
|
||||
import { getLifecycleLabel } from '../timerLifecycle';
|
||||
|
||||
describe('getLifecycleLabel', () => {
|
||||
it('returns the shared label for known lifecycle values', () => {
|
||||
expect(getLifecycleLabel(TimerLifeCycle.onClock)).toBe('Every second');
|
||||
});
|
||||
|
||||
it('keeps unknown lifecycle values visible', () => {
|
||||
expect(getLifecycleLabel('future-lifecycle')).toBe('future-lifecycle');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { TimerLifeCycle } from 'ontime-types';
|
||||
|
||||
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',
|
||||
};
|
||||
|
||||
export function getLifecycleLabel(cycle: TimerLifeCycle | string): string {
|
||||
return lifecycleLabels[cycle as TimerLifeCycle] ?? cycle;
|
||||
}
|
||||
Reference in New Issue
Block a user