Skip to content

Commit

Permalink
chore: add reset action for viz reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Jan 19, 2024
1 parent 20c00ec commit 3b038ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
export enum VizMSEActions {
PurgeRundown = 'purgeRundown',
ClearAllEngines = 'clearAllEngines',
Reset = 'reset',
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
"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 @@ -223,6 +223,11 @@ export class VizMSEDevice extends DeviceWithState<VizMSEState, DeviceOptionsVizM
commands: this._initOptions?.clearAllCommands || [],
})
}
public async resetViz(): Promise<void> {
await this.purgeRundown(true) // note - this might not be 100% necessary
await this.clearEngines()
await this._vizmseManager?.activate(undefined)
}

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

0 comments on commit 3b038ad

Please sign in to comment.