Skip to content

Commit

Permalink
chore: add rundownId to viz reset aciton
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Mar 4, 2024
1 parent ad82b8c commit 4ea028e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,22 @@ export interface VizMSEOptions {

export type SomeMappingVizMSE = Record<string, never>

export interface VizResetPayload {
/**
* Optional property
*/
activeRundownPlaylistId?: string
}

export interface ActivatePayload {
activeRundownPlaylistId: string
clearAll?: boolean
}

export enum VizMSEActions {
VizReset = 'vizReset',
PurgeRundown = 'purgeRundown',
Activate = 'activate',
StandDown = 'standDown',
ClearAllEngines = 'clearAllEngines',
Reset = 'reset',
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{
"$schema": "../../../$schemas/action-schema.json",
"actions": [
{
"id": "vizReset",
"name": "Reset",
"description": "Purges all rundowns, clears the engine and reactivates the Viz playlist",
"destructive": true,
"timeout": 10000,
"payload": {
"type": "object",
"properties": {
"activeRundownPlaylistId": {
"name": "Rundown playlist ID",
"description": "Optional property",
"type": "string"
}
},
"additionalProperties": false
}
},
{
"id": "purgeRundown",
"name": "Purge Viz Rundown",
Expand Down Expand Up @@ -33,13 +51,6 @@
"description": "Clears all Engines in the Profile by sending the configured list of clear-commands",
"destructive": true,
"timeout": 10000
},
{
"id": "reset",
"name": "Reset",
"description": "Purges all rundowns, clears the engine and reactivates the Viz playlist",
"destructive": true,
"timeout": 10000
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
SomeMappingVizMSE,
TimelineContentVIZMSEElementPilot,
TimelineContentVIZMSEElementInternal,
VizResetPayload,
} from 'timeline-state-resolver-types'

import { createMSE, MSE } from '@tv2media/v-connection'
Expand Down Expand Up @@ -267,10 +268,10 @@ export class VizMSEDevice extends DeviceWithState<VizMSEState, DeviceOptionsVizM
commands: this._initOptions?.clearAllCommands || [],
})
}
public async resetViz(): Promise<void> {
public async resetViz(payload: VizResetPayload): Promise<void> {
await this.purgeRundown(true) // note - this might not be 100% necessary
await this.clearEngines()
await this._vizmseManager?.activate(undefined)
await this._vizmseManager?.activate(payload?.activeRundownPlaylistId)
}

async executeAction(actionId: string, payload?: Record<string, any> | undefined): Promise<ActionExecutionResult> {
Expand All @@ -285,8 +286,8 @@ export class VizMSEDevice extends DeviceWithState<VizMSEState, DeviceOptionsVizM
case VizMSEActions.ClearAllEngines:
await this.clearEngines()
return { result: ActionExecutionResultCode.Ok }
case VizMSEActions.Reset:
await this.resetViz()
case VizMSEActions.VizReset:
await this.resetViz(payload ?? {})
return { result: ActionExecutionResultCode.Ok }
default:
return { result: ActionExecutionResultCode.Ok, response: t('Action "{{id}}" not found', { actionId }) }
Expand Down

0 comments on commit 4ea028e

Please sign in to comment.