mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 10:53:51 +00:00
feat: event cue (#473)
* feat: parse cue * refactor: get delay from backend * feat: add cue to UI * refactor: remove deprecated delay logic * refactor: extract studio clock specific logic * refactor: extract utilities * refactor: fix issue with missing key * style: prevent cue overflow * style: prevent whitespace wrap * feat: add support for cues in integrations
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Class Event Provider is a mediator for handling the local db
|
||||
* and adds logic specific to ontime data
|
||||
*/
|
||||
import { EventData, ViewSettings } from 'ontime-types';
|
||||
import { EventData, OntimeRundown, ViewSettings } from 'ontime-types';
|
||||
|
||||
import { data, db } from '../../modules/loadDb.js';
|
||||
import { safeMerge } from './DataProvider.utils.js';
|
||||
@@ -22,19 +22,15 @@ export class DataProvider {
|
||||
return data.eventData;
|
||||
}
|
||||
|
||||
static async setRundown(newData) {
|
||||
static async setRundown(newData: OntimeRundown) {
|
||||
data.rundown = [...newData];
|
||||
await this.persist();
|
||||
}
|
||||
|
||||
static getIndexOf(eventId) {
|
||||
static getIndexOf(eventId: string) {
|
||||
return data.rundown.findIndex((e) => e.id === eventId);
|
||||
}
|
||||
|
||||
static getEventById(eventId) {
|
||||
return data.rundown.find((e) => e.id === eventId);
|
||||
}
|
||||
|
||||
static getRundownLength() {
|
||||
return data.rundown.length;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,16 @@ export class EventLoader {
|
||||
return timedEvents.find((event) => event.id === eventId);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns first event given its cue
|
||||
* @param {string} cue
|
||||
* @return {object | undefined}
|
||||
*/
|
||||
static getEventWithCue(cue) {
|
||||
const timedEvents = EventLoader.getTimedEvents();
|
||||
return timedEvents.find((event) => event.cue === cue);
|
||||
}
|
||||
|
||||
/**
|
||||
* loads an event given its id
|
||||
* @param {string} eventId
|
||||
|
||||
Reference in New Issue
Block a user