Skip to content

Commit

Permalink
ensure targeted run is executed when user presses run button
Browse files Browse the repository at this point in the history
also graceful exit when run execution fails (for example when rta is
confused by disabled app/channel)
  • Loading branch information
justintucker1 committed Oct 30, 2024
1 parent 630b37b commit 840b1a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/viewProviders/RokuAutomationViewViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export class RokuAutomationViewViewProvider extends BaseRdbViewProvider {

this.addMessageCommandCallback(ViewProviderCommand.runRokuAutomationConfig, async (message) => {
const index = message.context.configIndex;
await this.runRokuAutomationConfig(index);
try {
await this.runRokuAutomationConfig(index);
} catch (e) {
this.updateCurrentRunningStep(-1);
throw e;
}
return true;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
$: runs, selectedRun, updateRuns();
const getRunIndex = () => (runs ?? []).findIndex((r) => r.name === selectedRun);
const updateRuns = () => {
if (!runs || runs.length === 0) {
runs = [{ }];
}
if (!selectedRun || runs.findIndex((c) => c.name === selectedRun) === -1) {
if (!selectedRun || getRunIndex() === -1) {
if (!runs[0].name) {
runs[0].name = 'DEFAULT';
}
Expand Down Expand Up @@ -128,14 +130,14 @@
function runConfig() {
intermediary.sendCommand(ViewProviderCommand.runRokuAutomationConfig, {
configIndex: this.id
configIndex: getRunIndex().toString()
});
}
function stopConfig() {
if (!this) return;
intermediary.sendCommand(ViewProviderCommand.stopRokuAutomationConfig, {
configIndex: this.id
configIndex: getRunIndex().toString()
});
}
Expand Down

0 comments on commit 840b1a2

Please sign in to comment.