vm management

This commit is contained in:
Mateusz Gruszczyński
2025-10-17 16:31:42 +02:00
parent d53860a9c3
commit 7441e64be4
2 changed files with 20 additions and 4 deletions

View File

@@ -293,7 +293,7 @@ function renderVmDetailCard(d) {
// ------ Node detail card ------ // ------ Node detail card ------
function renderNodeDetailCard(d) { function renderNodeDetailCard(d) {
const st = d.status || {}; const st = d.status || {}; lastSt = st;
const ver = d.version || {}; const ver = d.version || {};
const tm = d.time || {}; const tm = d.time || {};
const netcfg = ensureArr(d.network_cfg); const netcfg = ensureArr(d.network_cfg);
@@ -750,8 +750,8 @@ async function renderVMAdmin() {
await vmAction(sid, action, needsTarget ? getTarget() : undefined); await vmAction(sid, action, needsTarget ? getTarget() : undefined);
const exit = (finalSt && finalSt.exitstatus) ? String(finalSt.exitstatus) : ''; const exit = (finalSt && finalSt.exitstatus) ? String(finalSt.exitstatus) : '';
const ok = exit.toUpperCase() === 'OK'; const ok = exit.toUpperCase() === 'OK';
const badgeCell2 = tr.children[4]; const badgeCell = tr.children[4];
if (badgeCell2) badgeCell2.innerHTML = ok ? badge('running', 'ok') : badge('migrate error', 'err'); 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'))); log.textContent += (log.textContent ? '\n' : '') + (ok ? 'Migration finished successfully.' : ('Migration failed: ' + (exit || 'unknown error')));
await doRefresh(); await doRefresh();
} }
@@ -777,6 +777,7 @@ async function renderVMAdmin() {
async function pollTask(upid, node, onUpdate, onDone) { async function pollTask(upid, node, onUpdate, onDone) {
let lastSt = null;
let lastSt = null; let lastSt = null;
if (!upid || !node) return; if (!upid || !node) return;
const started = Date.now(); 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 r = await fetch('/api/task-status?upid=' + encodeURIComponent(upid) + '&node=' + encodeURIComponent(node));
const d = await r.json(); const d = await r.json();
if (d && d.ok) { 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(); const s = (st.status || '').toLowerCase();
if (s === 'stopped' || st.exitstatus) break; if (s === 'stopped' || st.exitstatus) break;
} }

View File

@@ -70,3 +70,18 @@ footer.site-footer a {
footer.site-footer a:hover { footer.site-footer a:hover {
text-decoration: underline; 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);
}