diff --git a/ui/general/health.js b/ui/general/health.js index 1a8391d..ac3e35d 100644 --- a/ui/general/health.js +++ b/ui/general/health.js @@ -2,6 +2,9 @@ // Elements const drone = document.getElementById("drone"); const droneDropdown = document.getElementById("droneSelection"); +const droneName = document.getElementById("name"); +const address = document.getElementById("address"); +const container = document.getElementById("container"); const drones = [ ["1", "mu1"], ["2", "mu2"], ["3", "mu3"], @@ -19,22 +22,27 @@ function initPage() { // Search for drones files in the services directory and populate the dropdown with directory names addDropDown(droneDropdown, drones, "1"); - const command1 = "hostname -I" - const command2 = "hostname" + const command1 = "hostname" + const command2 = "hostname -I" const command3 = "docker container ls" cockpit.spawn(["bash", "-c", command1]) .then((data) => { - console.log(data.split(" ")[0]); + droneName.innerHTML = data.split(" ")[0]; }) .catch((error) => console.log(error)); cockpit.spawn(["bash", "-c", command2]) .then((data) => { - console.log(data.split(" ")[0]); + address.innerHTML = data.split(" ")[0]; }) .catch((error) => console.log(error)); cockpit.spawn(["bash", "-c", command3]) .then((data) => { - console.log(data.split(" ")[0]); + const datalist = data.split("\n"); + 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] }) .catch((error) => console.log(error)); }