diff options
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>`; } |