diff --git a/ReleaseNotes.md b/ReleaseNotes.md index e0afcdd..668f08e 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,19 +1,9 @@ -## Version 0.1.4 +## Version 0.1.5 --- Release highlights: -* Added user preferences -* Added ability to stagger starting applications +* Added correct icon +* made runner start and stop the same button which just toggles. --- - -## Preferences - -There is now a Preferences page under `Options -> Preferences`. - -This allows configuration of a few options including Auto opening Release Notes after an upgrade, and an optional delay to stagger batch starting of applications. - -Read more in the [Wiki](https://github.com/ste2425/DotnetRunner/wiki/Preferences){.open-external} - - \ No newline at end of file diff --git a/app/Components/runner/Runner.js b/app/Components/runner/Runner.js index c19159b..f20cf63 100644 --- a/app/Components/runner/Runner.js +++ b/app/Components/runner/Runner.js @@ -33,41 +33,38 @@ module.exports = class RunnerElement extends WebComponentBase { if (this.state != undefined) this.setState(this.state); - const start = shadow.querySelector('.start'); - const stop = shadow.querySelector('.terminate'); const clearLog = shadow.querySelector('.clear-log'); - start.addEventListener('click', (e) => this.onStart()); - stop.addEventListener('click', (e) => this.onTerminate()); clearLog.addEventListener('click', () => this.clearData()); + + shadow.querySelector('.action').addEventListener('click', this._onToggle.bind(this)); } - _enableStart() { + _enableAction() { if (!this.shadowRoot) return; - this.shadowRoot.querySelector('.start').removeAttribute('disabled'); + this.shadowRoot.querySelector('.action').removeAttribute('disabled'); } - _disableStart() { + _disableAction() { if (!this.shadowRoot) return; - this.shadowRoot.querySelector('.start').setAttribute('disabled', 'disabled'); + this.shadowRoot.querySelector('.action').setAttribute('disabled', 'disabled'); } - _enableStop() { - if (!this.shadowRoot) + _onToggle() { + if (this.state !== RunnerElement.states.stopped && this.state !== RunnerElement.states.running) return; - this.shadowRoot.querySelector('.terminate').removeAttribute('disabled'); - } - - _disableStop() { - if (!this.shadowRoot) - return; + const isRunning = this.state !== RunnerElement.states.stopped; - this.shadowRoot.querySelector('.terminate').setAttribute('disabled', 'disabled'); + if (isRunning) { + this.onTerminate(); + } else { + this.onStart(); + } } onStart() { @@ -138,8 +135,7 @@ module.exports = class RunnerElement extends WebComponentBase { } setState(state) { - this._disableStart(); - this._disableStop(); + this._disableAction(); this.state = state; @@ -147,26 +143,30 @@ module.exports = class RunnerElement extends WebComponentBase { return; const stateEl = this.shadowRoot.querySelector('.state'); + const actionBtn = this.shadowRoot.querySelector('.action'); switch(state) { case RunnerElement.states.starting: stateEl.textContent = 'Starting'; stateEl.className = 'state badge badge-info'; - this._enableStop(); + actionBtn.textContent = 'Stop'; break; case RunnerElement.states.running: stateEl.textContent = 'Running'; stateEl.className = 'state badge badge-success'; - this._enableStop(); + actionBtn.textContent = 'Stop'; + this._enableAction(); break; case RunnerElement.states.stopping: stateEl.textContent = 'Stopping'; stateEl.className = 'state badge badge-info'; + actionBtn.textContent = 'Start'; break; case RunnerElement.states.stopped: stateEl.textContent = 'Stopped'; stateEl.className = 'state badge badge-secondary'; - this._enableStart(); + this._enableAction(); + actionBtn.textContent = 'Start'; break; } } diff --git a/app/Components/runner/runner.html b/app/Components/runner/runner.html index 5aea435..f9d42e9 100644 --- a/app/Components/runner/runner.html +++ b/app/Components/runner/runner.html @@ -3,9 +3,8 @@