mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-01 20:39:18 +00:00
feat: create group from entry selection
This commit is contained in:
committed by
Carlos Valente
parent
a8b52a48f7
commit
f1f7bad25e
@@ -14,9 +14,9 @@ import {
|
||||
} from 'ontime-types';
|
||||
import { getCueCandidate } from 'ontime-utils';
|
||||
|
||||
import { block as blockDef, delay as delayDef } from '../../models/eventsDefinition.js';
|
||||
import { delay as delayDef } from '../../models/eventsDefinition.js';
|
||||
import { sendRefetch } from '../../adapters/websocketAux.js';
|
||||
import { 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 { runtimeService } from '../runtime-service/RuntimeService.js';
|
||||
|
||||
@@ -55,7 +55,7 @@ function generateEvent<T extends Partial<OntimeEvent> | Partial<OntimeDelay> | P
|
||||
|
||||
// TODO(v4): allow user to provide a larger patch of the block entry
|
||||
if (isOntimeBlock(eventData)) {
|
||||
return { ...blockDef, title: eventData?.title ?? '', id } as CompleteEntry<T>;
|
||||
return createBlock({ id, title: eventData.title ?? '' }) as CompleteEntry<T>;
|
||||
}
|
||||
|
||||
throw new Error('Invalid event type');
|
||||
@@ -235,6 +235,22 @@ export async function dissolveBlock(blockId: EntryId) {
|
||||
return newRundown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups a list of entries into a block
|
||||
*/
|
||||
export async function groupEntries(entryIds: EntryId[]) {
|
||||
const scopedMutation = cache.mutateCache(cache.groupEntries);
|
||||
const { newRundown } = await scopedMutation({ entryIds });
|
||||
|
||||
// notify runtime that rundown has changed
|
||||
updateRuntimeOnChange();
|
||||
|
||||
// we dont need to modify the timer since the grouping does not affect the runtime
|
||||
notifyChanges({ external: true });
|
||||
|
||||
return newRundown;
|
||||
}
|
||||
|
||||
/**
|
||||
* swaps two events
|
||||
* @param {string} from - id of event from
|
||||
|
||||
Reference in New Issue
Block a user