From 11ac75b0c56385a8f9f042ddd4513588a52aa5db Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 11 Dec 2022 20:01:32 -0800 Subject: [PATCH] set instance color --- node.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node.js b/node.js index 8a7d05f..c0286d5 100644 --- a/node.js +++ b/node.js @@ -34,7 +34,8 @@ class Node extends HTMLElement { let qemuDiv = document.createElement("div"); for (let i = 0; i < qemu.length; i++) { let instanceParagraph = document.createElement("p"); - instanceParagraph.innerText = `VM | ${qemu[i].vmid} | ${qemu[i].name}`; + instanceParagraph.innerText = `VM | ${qemu[i].vmid} | ${qemu[i].name} | ${qemu[i].status}`; + instanceParagraph.style.color = qemu[i].status == "running" ? "#00ff00" : "#ff0000"; qemuDiv.append(instanceParagraph); } articleElement.append(qemuDiv); @@ -46,7 +47,8 @@ class Node extends HTMLElement { let lxcDiv = document.createElement("div"); for (let i = 0; i < lxc.length; i++) { let instanceParagraph = document.createElement("p"); - instanceParagraph.innerText = `CT | ${lxc[i].vmid} | ${lxc[i].name}`; + instanceParagraph.innerText = `CT | ${lxc[i].vmid} | ${lxc[i].name} | ${qemu[i].status}`; + instanceParagraph.style.color = lxc[i].status == "running" ? "#00ff00" : "#ff0000"; lxcDiv.append(instanceParagraph); } articleElement.append(lxcDiv);