mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 23:19:09 +00:00
refactor: refetch targets is enum
This commit is contained in:
committed by
Carlos Valente
parent
256a851c9b
commit
e7cfb7d9d9
@@ -1,5 +1,10 @@
|
|||||||
import { socket } from './WebsocketAdapter.js';
|
import { socket } from './WebsocketAdapter.js';
|
||||||
|
|
||||||
|
export enum RefetchTargets {
|
||||||
|
Rundown = 'rundown',
|
||||||
|
Report = 'report',
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function to notify clients that the REST data is stale
|
* Utility function to notify clients that the REST data is stale
|
||||||
* @param payload -- possible patch payload
|
* @param payload -- possible patch payload
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { OntimeReport, OntimeEventReport, TimerLifeCycle } from 'ontime-types';
|
import { OntimeReport, OntimeEventReport, TimerLifeCycle } from 'ontime-types';
|
||||||
import { RuntimeState } from '../../stores/runtimeState.js';
|
import { RuntimeState } from '../../stores/runtimeState.js';
|
||||||
import { sendRefetch } from '../../adapters/websocketAux.js';
|
import { RefetchTargets, sendRefetch } from '../../adapters/websocketAux.js';
|
||||||
import { DeepReadonly } from 'ts-essentials';
|
import { DeepReadonly } from 'ts-essentials';
|
||||||
|
|
||||||
const report = new Map<string, OntimeEventReport>();
|
const report = new Map<string, OntimeEventReport>();
|
||||||
@@ -58,7 +58,7 @@ export function triggerReportEntry(
|
|||||||
report.set(eventId, { startedAt, endedAt: state.clock });
|
report.set(eventId, { startedAt, endedAt: state.clock });
|
||||||
formattedReport = null;
|
formattedReport = null;
|
||||||
sendRefetch({
|
sendRefetch({
|
||||||
target: 'REPORT',
|
target: RefetchTargets.Report,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
import { getCueCandidate } from 'ontime-utils';
|
import { getCueCandidate } from 'ontime-utils';
|
||||||
|
|
||||||
import { delay as delayDef } from '../../models/eventsDefinition.js';
|
import { delay as delayDef } from '../../models/eventsDefinition.js';
|
||||||
import { sendRefetch } from '../../adapters/websocketAux.js';
|
import { RefetchTargets, sendRefetch } from '../../adapters/websocketAux.js';
|
||||||
import { createBlock, createEvent } from '../../api-data/rundown/rundown.utils.js';
|
import { createBlock, createEvent } from '../../api-data/rundown/rundown.utils.js';
|
||||||
import { updateRundownData } from '../../stores/runtimeState.js';
|
import { updateRundownData } from '../../stores/runtimeState.js';
|
||||||
import { runtimeService } from '../runtime-service/RuntimeService.js';
|
import { runtimeService } from '../runtime-service/RuntimeService.js';
|
||||||
@@ -334,7 +334,7 @@ function notifyChanges(options: NotifyChangesOptions) {
|
|||||||
if (options.external) {
|
if (options.external) {
|
||||||
// advice socket subscribers of change
|
// advice socket subscribers of change
|
||||||
const payload = {
|
const payload = {
|
||||||
target: 'RUNDOWN',
|
target: RefetchTargets.Rundown,
|
||||||
changes: Array.isArray(options.timer) ? options.timer : undefined,
|
changes: Array.isArray(options.timer) ? options.timer : undefined,
|
||||||
reload: options.reload,
|
reload: options.reload,
|
||||||
revision: cache.getMetadata().revision,
|
revision: cache.getMetadata().revision,
|
||||||
|
|||||||
Reference in New Issue
Block a user