From d739e3de6934b4b0cc875c53c7a4c57065b17c93 Mon Sep 17 00:00:00 2001 From: Alice Sedgwick Date: Fri, 29 Nov 2024 13:35:27 -0500 Subject: [PATCH] Added new rows and containers error message --- ui/general/health.html | 32 ++++++++++++++++++++++++++++++++ ui/general/health.js | 14 ++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ui/general/health.html b/ui/general/health.html index 75493a4..da77730 100644 --- a/ui/general/health.html +++ b/ui/general/health.html @@ -39,6 +39,38 @@ Docker Container + + Connection Upstream + + + + Network SSID + + + + Camera Devices + + + + Connected Devices + + + + Zerotier IP + N/A + + + Hotspot Connections + N/A + + + GCS + N/A + + + FCU Firmware + N/A + diff --git a/ui/general/health.js b/ui/general/health.js index 80cd38d..ff6e2f4 100644 --- a/ui/general/health.js +++ b/ui/general/health.js @@ -14,6 +14,7 @@ function initPage() { const command1 = "hostname" const command2 = "hostname -I" const command3 = "docker container ls" + const command4 = "" cockpit.spawn(["bash", "-c", command1]) .then((data) => { droneName.innerHTML = data.split(" ")[0]; @@ -27,11 +28,16 @@ function initPage() { cockpit.spawn(["bash", "-c", command3]) .then((data) => { const datalist = data.split("\n"); - for (let i = 0; i < datalist.length - 2; i++) { - container.innerHTML += datalist[i + 1].split(" ")[0]; - container.innerHTML += "
"; + if (datalist[1].split(" ")[0] == ""){ + container.className = "p-3 mb-2 bg-danger text-white"; + container.innerHTML += "Error: No Docker Containers to Display"; + } else { + for (let i = 0; i < datalist.length - 2; i++) { + container.innerHTML += datalist[i + 1].split(" ")[0]; + container.innerHTML += "
"; + } + container.innerHTML += datalist[datalist.length - 1].split(" ")[0]; } - container.innerHTML += datalist[datalist.length - 1].split(" ")[0] }) .catch((error) => console.log(error)); } \ No newline at end of file