mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 21:24:11 +00:00
Event trigger (#1557)
* crude UI * add server functionalety * better event trigger list * fix default value * remove log * add trigger to recalculate whitelist * use DTO type * fix rebase * one callback for delete and submit * refactor * add invalid description * clean up commits * cleanup * refactor: find event triggers in `triggerAutomations` * refactor: switch to flat array for event triggers * prevent deleting a automation that is in use * refactor * refactor: extract EventEditorCustom * move trigger options to separate file * move trigger edit down a file level * cleanup * spelling * refactor: ui review proposal * change default value * fix delete filter --------- Co-authored-by: Carlos Valente <carlosvalente@pm.me>
This commit is contained in:
committed by
GitHub
parent
6817263123
commit
a94b10cb0f
@@ -1,4 +1,4 @@
|
||||
import type { EndAction, EventCustomFields, MaybeString, TimerType, TimeStrategy } from '../../index.js';
|
||||
import type { EndAction, EventCustomFields, MaybeString, TimerType, TimeStrategy, Trigger } from '../../index.js';
|
||||
|
||||
export enum SupportedEvent {
|
||||
Event = 'event',
|
||||
@@ -44,6 +44,7 @@ export type OntimeEvent = OntimeBaseEvent & {
|
||||
timeWarning: number;
|
||||
timeDanger: number;
|
||||
custom: EventCustomFields;
|
||||
triggers?: Trigger[];
|
||||
};
|
||||
|
||||
export type PlayableEvent = OntimeEvent & { skip: false };
|
||||
|
||||
@@ -104,10 +104,10 @@ export {
|
||||
isOntimeDelay,
|
||||
isOntimeEvent,
|
||||
isPlayableEvent,
|
||||
isOntimeCycle,
|
||||
isKeyOfType,
|
||||
isOSCOutput,
|
||||
isHTTPOutput,
|
||||
isOntimeAction,
|
||||
isTimerLifeCycle,
|
||||
} from './utils/guards.js';
|
||||
export type { MaybeNumber, MaybeString } from './utils/utils.type.js';
|
||||
|
||||
@@ -2,8 +2,7 @@ import type { AutomationOutput, HTTPOutput, OntimeAction, OSCOutput } from '../d
|
||||
import type { OntimeBlock, OntimeDelay, OntimeEvent, PlayableEvent } from '../definitions/core/OntimeEvent.type.js';
|
||||
import { SupportedEvent } from '../definitions/core/OntimeEvent.type.js';
|
||||
import type { OntimeRundownEntry } from '../definitions/core/Rundown.type.js';
|
||||
import type { TimerLifeCycleKey } from '../definitions/core/TimerLifecycle.type.js';
|
||||
import { TimerLifeCycle } from '../definitions/core/TimerLifecycle.type.js';
|
||||
import { type TimerLifeCycle, timerLifecycleValues } from '../definitions/core/TimerLifecycle.type.js';
|
||||
|
||||
type MaybeEvent = OntimeRundownEntry | Partial<OntimeRundownEntry> | null | undefined;
|
||||
|
||||
@@ -29,11 +28,6 @@ export function isKeyOfType<T extends object>(key: PropertyKey, obj: T): key is
|
||||
return key in obj;
|
||||
}
|
||||
|
||||
export function isOntimeCycle(maybeCycle: unknown): maybeCycle is TimerLifeCycleKey {
|
||||
if (typeof maybeCycle !== 'string') return false;
|
||||
return Object.values(TimerLifeCycle).includes(maybeCycle as TimerLifeCycle);
|
||||
}
|
||||
|
||||
export function isOSCOutput(output: AutomationOutput): output is OSCOutput {
|
||||
return output.type === 'osc';
|
||||
}
|
||||
@@ -45,3 +39,8 @@ export function isHTTPOutput(output: AutomationOutput): output is HTTPOutput {
|
||||
export function isOntimeAction(output: AutomationOutput): output is OntimeAction {
|
||||
return output.type === 'ontime';
|
||||
}
|
||||
|
||||
export function isTimerLifeCycle(maybeCycle: unknown): maybeCycle is TimerLifeCycle {
|
||||
if (typeof maybeCycle !== 'string') return false;
|
||||
return timerLifecycleValues.includes(maybeCycle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user