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 Jan 22, 2024
1 parent 3b038ad commit cd0e887
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run "yarn generate-schema-types" to regenerate this file.
*/
export interface VizResetPayload {
/**
* Optional property
*/
activeRundownPlaylistId?: string
}

export enum VizMSEActions {
VizReset = 'vizReset',
PurgeRundown = 'purgeRundown',
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 All @@ -14,13 +32,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 @@ -19,6 +19,7 @@ import {
VizMSEActions,
TimelineContentVIZMSEElementPilot,
TimelineContentVIZMSEElementInternal,
VizResetPayload,
} from 'timeline-state-resolver-types'

import { createMSE, MSE } from '@tv2media/v-connection'
Expand Down Expand Up @@ -223,22 +224,22 @@ 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> {
async executeAction(actionId: string, payload?: Record<string, any> | undefined): Promise<ActionExecutionResult> {
switch (actionId) {
case VizMSEActions.PurgeRundown:
await this.purgeRundown(true)
return { result: ActionExecutionResultCode.Ok }
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 cd0e887

Please sign in to comment.