diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-04 16:50:32 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-04 16:50:32 +0200 |
| commit | 13d145253a871ef47ef4344f90566eea21b994ab (patch) | |
| tree | 60518001aee6966ac4842b6a56bbc429d2315839 /packages/meshbay-hub/src/meshbay_hub/static/node-page.js | |
| parent | 046d847c1b7ba9fcc8e0f3be6e4ff13dac016479 (diff) | |
| download | meshbay-13d145253a871ef47ef4344f90566eea21b994ab.tar.gz | |
fix(client): Stop/Restart buttons and an autostart toggle on the Node page
Root cause of both reports: node:service-status's `installed` field was
winAutostartInstalled() -- whether the Startup-folder launcher exists --
not whether the daemon can be managed at all. The Node page gates
Stop/Restart on `installed`, so with no autostart configured (the default
-- nothing installs it automatically) those buttons silently never
rendered, leaving only Start. A perfectly manageable daemon looked
unmanageable because a different, unrelated setting was off.
installed now reflects the actual daemon binary (findNodeBinary()), same
definition node:installed already used; autostart moves to its own field
carrying what installed used to mean.
That field also fixes the other half: there was no way to turn autostart
on except the CLI. NodeServicePanel now shows a toggle-switch next to
Start/Stop/Restart, wired through a new platform.node.autostart
(install/remove) that mirrors the existing service.* pattern -- the
preload/main.js bridge (W3) was already there, just never called from the
interface. English and French strings; other locales fall back to English
per the project's own stated policy (test_locales.py's own docstring).
Verified: node --check on every edited file; hub/node suites green
(863 pass, 0 fail — pre-existing test_locales.py encoding failures on
this Windows checkout are unrelated, reproduced identically on the
clean tree).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/node-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/node-page.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js index a2d3e49..c619f6e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js @@ -47,6 +47,12 @@ function NodeServicePanel({ onChanged }) { } }, [refresh, onChanged]); + const toggleAutostart = useCallback(() => { + act('autostart', () => (info && info.autostart + ? platform.node.autostart.remove() + : platform.node.autostart.install())); + }, [act, info]); + if (!platform.node.service.available) return null; if (!info || info.supported === false) { return html`<div class="node-service"> @@ -82,6 +88,14 @@ function NodeServicePanel({ onChanged }) { ${busy === 'restart' ? t('node.service_restarting') : t('node.service_restart')}</button> `} </div> + ${platform.node.autostart.available && typeof info.autostart === 'boolean' && html` + <label class="toggle-switch ${busy ? 'toggle-switch-disabled' : ''}"> + <input type="checkbox" checked=${info.autostart} disabled=${!!busy} + onChange=${toggleAutostart} /> + <span class="toggle-switch-track"><span class="toggle-switch-thumb"></span></span> + ${' '}${busy === 'autostart' ? t('node.autostart_updating') : t('node.autostart_label')} + </label> + `} </div>`; } |