Show each container's fallback tier on the Monitor board

The row's left border carries it rather than the status dot, which already means running or
stopped.
This commit is contained in:
Gmer4Lfe
2026-08-23 16:38:58 -04:00
parent 671e7ea5a4
commit 206a119a4b
3 changed files with 43 additions and 4 deletions
+14 -1
View File
@@ -2975,6 +2975,12 @@ function vvRenderDockerFolders(data) {
const stateColor = s => ({ running:'#4caf50', paused:'#ff9800' })[s] ?? '#444';
const stateLabel = s => ({ running:'Running', paused:'Paused', 'shut off':'Off', crashed:'Crashed' })[s] ?? s;
// Fallback tier stripe. Warm (comes back immediately) to cool (waits 24h), riding the row's
// left border rather than the status dot — the dot already means running vs stopped, and
// overloading it would make a stopped tier-1 container indistinguishable from a running one.
const tierColor = t => ({ 1:'#ff5252', 2:'#ffa726', 3:'#ffd54f', 4:'#4fc3f7' })[t] ?? '';
const tierWhen = t => ({ 1:'immediately', 2:'after 4h', 3:'after 12h', 4:'after 24h' })[t] ?? '';
// ── VMs section ─────────────────────────────────────────────────────────────
let html = '';
const vms = data.vms?.vms ?? [];
@@ -3033,7 +3039,14 @@ function vvRenderDockerFolders(data) {
class="vv-btn-sm vv-edit-btn">✎ Edit</button>
</div>`;
}
return `<div class="vv-df-container${active ? ' vv-df-active' : ''}"
// Tier arrives as an int from conf, but it is still payload — anything outside 1-4 gets no
// stripe rather than being interpolated into the style attribute.
const tNum = Number(c.tier);
const tOk = Number.isInteger(tNum) && tNum >= 1 && tNum <= 4;
const tSty = tOk ? ` style="border-left-color:${tierColor(tNum)};"` : '';
const tTip = tOk ? ` title="Fallback tier ${tNum} — partner starts this ${tierWhen(tNum)}"` : '';
return `<div class="vv-df-container${active ? ' vv-df-active' : ''}"${tSty}${tTip}
onclick="event.stopPropagation();vvToggleContainer('${sn}')">
<span class="vv-df-dot" style="background:${dot};${pulse}"></span>
<span class="vv-df-cname">${vvEscHtml(c.name)}</span>