From d15c564427eaae724f7bcf02e1e32f9a5cff6758 Mon Sep 17 00:00:00 2001 From: justin tucker <129927578+jtuckerfubo@users.noreply.github.com> Date: Mon, 7 Oct 2024 23:19:48 -0700 Subject: [PATCH 01/22] added controls to display, select, add, and remove automation configs --- .../RokuAutomationView/ConfigControls.svelte | 141 ++++++++++++++++++ .../RokuAutomationView.svelte | 40 +++-- 2 files changed, 165 insertions(+), 16 deletions(-) create mode 100644 webviews/src/views/RokuAutomationView/ConfigControls.svelte diff --git a/webviews/src/views/RokuAutomationView/ConfigControls.svelte b/webviews/src/views/RokuAutomationView/ConfigControls.svelte new file mode 100644 index 00000000..7b359f25 --- /dev/null +++ b/webviews/src/views/RokuAutomationView/ConfigControls.svelte @@ -0,0 +1,141 @@ + + + + + + + + + {#each configs ?? [] as config} + {config.name} + {/each} + + + + (showModal = true)} + title="Create a new configuration" + class="btn"> + + + + + + + (showModal = false)} + on:click|self={() => dialog.close()}> + + + Create a new configuration + + + + + + A configuration is a named set of autorun steps + Configurations are automatically saved + + + + + pressOK()}>create + dialog.close()}>close + + diff --git a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte index 0b3a5c2e..51f5eae8 100644 --- a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte +++ b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte @@ -5,12 +5,25 @@ import { ViewProviderEvent } from '../../../../src/viewProviders/ViewProviderEvent'; import { ViewProviderCommand } from '../../../../src/viewProviders/ViewProviderCommand'; import NumberField from '../../shared/NumberField.svelte'; + import ConfigControls from './ConfigControls.svelte'; window.vscode = acquireVsCodeApi(); + let configs; + let selectedConfig; let loading = true; let currentRunningStep = -1; + $: if (!configs || configs.length === 0) { + selectedConfig = 'DEFAULT'; + configs = [ { name: selectedConfig, steps: [{ type: 'sleep', value: '8' }] } ]; + } + + $: if (selectedConfig) { + steps = configs.find((c) => c.name === selectedConfig)?.steps ?? []; + storeConfigs(steps); + } + const stepTypes = { sleep: { type: 'sleep', @@ -54,11 +67,12 @@ function storeConfigs(updatedSteps) { if(!loading) { + configs = [ + { name: selectedConfig, steps: updatedSteps }, + ...configs.filter((c) => c.name !== selectedConfig) + ] intermediary.sendCommand(ViewProviderCommand.storeRokuAutomationConfigs, { - configs: [{ - name: 'DEFAULT', - steps: updatedSteps - }] + configs: configs }); } @@ -136,16 +150,9 @@ } intermediary.observeEvent(ViewProviderEvent.onRokuAutomationConfigsLoaded, (message) => { - const configs = message.context.configs; - if (configs) { - const config = configs[0]; - steps = config.steps; - } else { - steps = [{ - type: 'sleep', - value: '8' - }]; - } + configs = message.context.configs; + selectedConfig = configs[0].name; + steps = configs[0].steps; loading = false; }); @@ -300,7 +307,8 @@ {#if currentRunningStep >= 0} Stop {:else} - Run - Clear + Run + Clear + {/if} From 7accd13342912f707e732697a585450fc105d3b8 Mon Sep 17 00:00:00 2001 From: justin tucker <129927578+jtuckerfubo@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:56:25 -0700 Subject: [PATCH 02/22] Update webviews/src/views/RokuAutomationView/ConfigControls.svelte Co-authored-by: Bronley Plumb --- webviews/src/views/RokuAutomationView/ConfigControls.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webviews/src/views/RokuAutomationView/ConfigControls.svelte b/webviews/src/views/RokuAutomationView/ConfigControls.svelte index 7b359f25..7e50bf60 100644 --- a/webviews/src/views/RokuAutomationView/ConfigControls.svelte +++ b/webviews/src/views/RokuAutomationView/ConfigControls.svelte @@ -1,4 +1,4 @@ - + + + + + + + Manage Autoruns + + + + + selectedRun = e.target.value}> + {#each runs as run} + {run.name} + {/each} + + + + + Create + Copy + Delete + Move up + Move down + + + + + + + + + + Enter Run Name + + + + + OK + Cancel + + diff --git a/webviews/src/views/RokuAutomationView/ConfigControls.svelte b/webviews/src/views/RokuAutomationView/ConfigControls.svelte deleted file mode 100644 index 7e50bf60..00000000 --- a/webviews/src/views/RokuAutomationView/ConfigControls.svelte +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - {#each configs ?? [] as config} - {config.name} - {/each} - - - - (showModal = true)} - title="Create a new configuration" - class="btn"> - - - - - - - (showModal = false)} - on:click|self={() => dialog.close()}> - - - Create a new configuration - - - - - - A configuration is a named set of autorun steps - Configurations are automatically saved - - - - - pressOK()}>create - dialog.close()}>close - - diff --git a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte index 51f5eae8..509aa0a2 100644 --- a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte +++ b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte @@ -1,11 +1,11 @@ @@ -268,6 +272,10 @@ + Name of current run + + + {#each steps as step, index} From 4becf751159687cb6cfb76e61475f825e8bf1551 Mon Sep 17 00:00:00 2001 From: justin tucker Date: Mon, 28 Oct 2024 15:54:06 -0700 Subject: [PATCH 05/22] new ui per/BP, features a drop down style panel with an html table (includes a column of button actions), also no commit style semantics --- .../RokuAutomationView/AutoRunsEditor.svelte | 536 +++++++++++------- .../RokuAutomationView.svelte | 74 +-- 2 files changed, 353 insertions(+), 257 deletions(-) diff --git a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte index 0bc4592d..dc4010f9 100644 --- a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte +++ b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte @@ -1,261 +1,373 @@ - - - - - Manage Autoruns - - - - {#each runs as run} - - {run.name} - - - - - - - - - - - - - - - - - - - - - - {/each} - - - - selectedRun = e.target.value}> - {#each runs as run} - {run.name} - {/each} - - - - - Create - Copy - Delete - Move up - Move down - - + + + {selectedRun} + + + {#if showContent} + + + + {#each runs as run} + + + + + + + + + {run.name} + + + + + + + + + + + + {/each} + - - - + {/if} + - + Enter Run Name - + - OK - Cancel + OK + Cancel + + + + + Are you sure you want to delete this run? + + YES + NO diff --git a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte index f199297b..d4ad925b 100644 --- a/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte +++ b/webviews/src/views/RokuAutomationView/RokuAutomationView.svelte @@ -1,7 +1,7 @@ @@ -272,10 +258,10 @@ - Name of current run - - - + {#each steps as step, index} @@ -336,9 +322,7 @@ {#if currentRunningStep >= 0} Stop {:else} - Run - Clear - - Current run: {selectedConfig} + Run + Clear {/if} From 015df4403d18bf210197eb3a465f5888a835ec84 Mon Sep 17 00:00:00 2001 From: justin tucker Date: Mon, 28 Oct 2024 16:02:04 -0700 Subject: [PATCH 06/22] small usability improvements --- webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte index dc4010f9..25bec3a8 100644 --- a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte +++ b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte @@ -289,7 +289,7 @@ - {selectedRun} + {selectedRun} @@ -328,6 +329,7 @@ From 281cc4db2055259ae8366cfa2ad829a4c0bf38a9 Mon Sep 17 00:00:00 2001 From: justin tucker Date: Tue, 29 Oct 2024 14:16:49 -0700 Subject: [PATCH 07/22] added dnd run reordering --- .../RokuAutomationView/AutoRunsEditor.svelte | 81 +++++++++++++----- webviews/src/views/RokuAutomationView/dnd.js | 85 +++++++++++++++++++ 2 files changed, 145 insertions(+), 21 deletions(-) create mode 100644 webviews/src/views/RokuAutomationView/dnd.js diff --git a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte index 25bec3a8..a6d86dcd 100644 --- a/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte +++ b/webviews/src/views/RokuAutomationView/AutoRunsEditor.svelte @@ -1,5 +1,6 @@