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 | 19 |
1 files changed, 13 insertions, 6 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 04f4abc..11cd07e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js @@ -25,15 +25,20 @@ export function pairedFrom(result) { function NodeServicePanel({ onChanged, token, username }) { const [info, setInfo] = useState(null); const [busy, setBusy] = useState(''); - const [err, setErr] = useState(''); + // Two errors, not one: the status poll below cleared the message of an + // action that had just been refused, within five seconds and often before + // it was read (found switching startup mode on a real Store install). + const [pollErr, setPollErr] = useState(''); + const [actErr, setActErr] = useState(''); + const err = actErr || pollErr; const refresh = useCallback(async () => { try { const r = await platform.node.service.status(); setInfo(r); - setErr(''); + setPollErr(''); } catch (e) { - setErr(platform.bridgeMessage(e)); + setPollErr(platform.bridgeMessage(e)); } }, []); @@ -46,13 +51,13 @@ function NodeServicePanel({ onChanged, token, username }) { const act = useCallback(async (name, fn) => { setBusy(name); - setErr(''); + setActErr(''); try { await fn(); await refresh(); if (onChanged) onChanged(); } catch (e) { - setErr(platform.bridgeMessage(e)); + setActErr(platform.bridgeMessage(e)); } finally { setBusy(''); } @@ -162,7 +167,9 @@ function NodeServicePanel({ onChanged, token, username }) { ${busy === 'startupMode' && html` <p class="settings-hint">${t('node.startup_mode_updating')}</p>`} ${!info.canElevate && html` - <p class="settings-hint">${t('node.startup_mode_service_unavailable_hint')}</p>`} + <p class="settings-hint">${t(info.store + ? 'node.startup_mode_service_store_hint' + : 'node.startup_mode_service_unavailable_hint')}</p>`} `} </div>`; } |