Bug bash fixes: hash routing + back button, hub-only pages reset on machine switch, exited terminals reap after 10 min, self-update refuses while busy unless forced, touch-sized controls, power confirm by machine name, down interfaces collapsed and empty modules hidden, load label, offline backoff, cron log newest first, procs empty message, timer timestamp parsing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
27f9665606
commit
f093b322ee
+7
-6
@@ -3,16 +3,17 @@ import { api } from './api'
|
||||
import { Btn, Spinner } from './ui'
|
||||
|
||||
// Header power control: a small button, a dialog that needs the hostname typed back.
|
||||
export default function Power({ host, rebootNeeded }: { host: string; rebootNeeded?: boolean }) {
|
||||
// `label` is what the user types (the machine name on a remote); `host` is what the node checks.
|
||||
export default function Power({ host, label, rebootNeeded }: { host: string; label: string; rebootNeeded?: boolean }) {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [typed, setTyped] = useState('')
|
||||
const [sent, setSent] = useState<'' | 'reboot' | 'poweroff'>('')
|
||||
const [err, setErr] = useState('')
|
||||
const ok = typed.trim() === host
|
||||
const ok = typed.trim() === label
|
||||
|
||||
async function go(action: 'reboot' | 'poweroff') {
|
||||
setErr('')
|
||||
try { await api.power(action, typed.trim()); setSent(action) }
|
||||
try { await api.power(action, host); setSent(action) }
|
||||
catch (e) { setErr(e instanceof Error ? e.message : 'failed') }
|
||||
}
|
||||
|
||||
@@ -22,14 +23,14 @@ export default function Power({ host, rebootNeeded }: { host: string; rebootNeed
|
||||
{open && (
|
||||
<div className="modal-back" onClick={() => !sent && setOpen(false)}>
|
||||
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||
<h3>Power · {host}</h3>
|
||||
<h3>Power · {label}</h3>
|
||||
{rebootNeeded && <div className="notice">A reboot is pending from package updates.</div>}
|
||||
{sent ? (
|
||||
<div className="muted"><Spinner /> {sent === 'reboot' ? 'Rebooting. The console will reconnect when the host is back.' : 'Shutting down. Power it back on by hand.'}</div>
|
||||
) : (
|
||||
<>
|
||||
<label className="muted">Type the hostname to confirm
|
||||
<input autoFocus value={typed} onChange={(e) => setTyped(e.target.value)} placeholder={host} />
|
||||
<label className="muted">Type <b>{label}</b> to confirm
|
||||
<input autoFocus value={typed} onChange={(e) => setTyped(e.target.value)} placeholder={label} />
|
||||
</label>
|
||||
{err && <div className="error">{err}</div>}
|
||||
<div className="svc-actions">
|
||||
|
||||
Reference in New Issue
Block a user