diff --git a/static/main.js b/static/main.js index 20c803e..413e66c 100644 --- a/static/main.js +++ b/static/main.js @@ -293,7 +293,7 @@ function renderVmDetailCard(d) { // ------ Node detail card ------ function renderNodeDetailCard(d) { - const st = d.status || {}; + const st = d.status || {}; lastSt = st; const ver = d.version || {}; const tm = d.time || {}; const netcfg = ensureArr(d.network_cfg); @@ -750,8 +750,8 @@ async function renderVMAdmin() { await vmAction(sid, action, needsTarget ? getTarget() : undefined); const exit = (finalSt && finalSt.exitstatus) ? String(finalSt.exitstatus) : ''; const ok = exit.toUpperCase() === 'OK'; - const badgeCell2 = tr.children[4]; - if (badgeCell2) badgeCell2.innerHTML = ok ? badge('running', 'ok') : badge('migrate error', 'err'); + const badgeCell = tr.children[4]; + if (badgeCell) badgeCell.innerHTML = ok ? badge('running', 'ok') : badge('migrate error', 'err'); log.textContent += (log.textContent ? '\n' : '') + (ok ? 'Migration finished successfully.' : ('Migration failed: ' + (exit || 'unknown error'))); await doRefresh(); } @@ -777,6 +777,7 @@ async function renderVMAdmin() { async function pollTask(upid, node, onUpdate, onDone) { + let lastSt = null; let lastSt = null; if (!upid || !node) return; const started = Date.now(); @@ -787,7 +788,7 @@ async function pollTask(upid, node, onUpdate, onDone) { const r = await fetch('/api/task-status?upid=' + encodeURIComponent(upid) + '&node=' + encodeURIComponent(node)); const d = await r.json(); if (d && d.ok) { - const st = d.status || {}; lastSt = st; if (onUpdate) { try { onUpdate(st); } catch { } } + const st = d.status || {}; lastSt = st; lastSt = st; if (onUpdate) { try { onUpdate(st); } catch { } } const s = (st.status || '').toLowerCase(); if (s === 'stopped' || st.exitstatus) break; } diff --git a/static/styles.css b/static/styles.css index 0e1de1e..6b12139 100644 --- a/static/styles.css +++ b/static/styles.css @@ -69,4 +69,19 @@ footer.site-footer a { footer.site-footer a:hover { text-decoration: underline; +} + +/* Toast container constraints */ +#toast-container .toast { + max-width: min(420px, 90vw); + word-wrap: break-word; +} + +#toast-container { + max-width: 92vw; +} + +.position-fixed.top-0.end-0.p-3 { + right: max(env(safe-area-inset-right), 1rem); + top: max(env(safe-area-inset-top), 1rem); } \ No newline at end of file