mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
v2:feat (#231)
* style: element relationship * feat: utility to add first element * refactor: organise dir * ux: deleting element closes drawer * fix: issue with escaped characters * fix: issue with overflow in events list * fix: prevent event timer from receiving non event * style: prevent small shift on class change * style: visually detach event editor * fix: entry block knows last event * fix: skip event timer updates on non events * fix: prevent electron OPENGL error * style: cleanup text styles * style: unify input styles * refactor: simplify style and composition * refactor: tweaks on style + ts * refactor: add validation to events post * fix: handle non events in event timer * refactor: cleanup unused
This commit is contained in:
@@ -772,40 +772,45 @@ export class EventTimer extends Timer {
|
||||
* @param previousId
|
||||
*/
|
||||
insertEventAfterId(event, previousId) {
|
||||
// find object in events
|
||||
const previousIndex = this._eventlist.findIndex((e) => e.id === previousId);
|
||||
if (previousIndex === -1) {
|
||||
throw 'Event not found';
|
||||
}
|
||||
|
||||
if (previousIndex + 1 >= this._eventlist.length) {
|
||||
this._eventlist.push(event);
|
||||
if (typeof previousId === 'undefined') {
|
||||
// Insert at beginning
|
||||
this._eventlist.unshift(event);
|
||||
} else {
|
||||
this._eventlist.splice(previousIndex + 1, 0, event);
|
||||
}
|
||||
// find object in events
|
||||
const previousIndex = this._eventlist.findIndex((e) => e.id === previousId);
|
||||
if (previousIndex === -1) {
|
||||
throw 'Event not found';
|
||||
}
|
||||
|
||||
try {
|
||||
// check if entry is running
|
||||
if (event.id === this.selectedEventId) {
|
||||
// handle reload selected
|
||||
// Reload data if running
|
||||
const type =
|
||||
this.selectedEventId === event.id && this._startedAt != null ? 'reload' : 'load';
|
||||
this.loadEvent(this.selectedEventIndex, type);
|
||||
} else if (event.id === this.nextEventId) {
|
||||
// roll needs to recalculate
|
||||
if (this.state === 'roll') {
|
||||
this.rollLoad();
|
||||
if (previousIndex + 1 >= this._eventlist.length) {
|
||||
this._eventlist.push(event);
|
||||
} else {
|
||||
this._eventlist.splice(previousIndex + 1, 0, event);
|
||||
}
|
||||
|
||||
try {
|
||||
// check if entry is running
|
||||
if (event.id === this.selectedEventId) {
|
||||
// handle reload selected
|
||||
// Reload data if running
|
||||
const type =
|
||||
this.selectedEventId === event.id && this._startedAt != null ? 'reload' : 'load';
|
||||
this.loadEvent(this.selectedEventIndex, type);
|
||||
} else if (event.id === this.nextEventId) {
|
||||
// roll needs to recalculate
|
||||
if (this.state === 'roll') {
|
||||
this.rollLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load titles
|
||||
if ('title' in event || 'subtitle' in event || 'presenter' in event) {
|
||||
this._loadTitlesNext();
|
||||
this._loadTitlesNow();
|
||||
// load titles
|
||||
if ('title' in event || 'subtitle' in event || 'presenter' in event) {
|
||||
this._loadTitlesNext();
|
||||
this._loadTitlesNow();
|
||||
}
|
||||
} catch (error) {
|
||||
this.socket.error('SERVER', error);
|
||||
}
|
||||
} catch (error) {
|
||||
this.socket.error('SERVER', error);
|
||||
}
|
||||
|
||||
// update clients
|
||||
@@ -815,21 +820,6 @@ export class EventTimer extends Timer {
|
||||
this.runCycle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description inserts an event in the first position of the list
|
||||
* @param event
|
||||
*/
|
||||
insertEventAtStart(event) {
|
||||
// Insert at beginning
|
||||
this._eventlist.unshift(event);
|
||||
|
||||
// update clients
|
||||
this.broadcastState();
|
||||
|
||||
// run cycle
|
||||
this.runCycle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleted an event from the list by its id
|
||||
* @param {string} eventId
|
||||
|
||||
Reference in New Issue
Block a user