Added new rows and containers error message
This commit is contained in:
parent
8d2f837c01
commit
d739e3de69
|
@ -39,6 +39,38 @@
|
|||
<th scope="row">Docker Container</th>
|
||||
<td id="container"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Connection Upstream</th>
|
||||
<td id="upstream"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Network SSID</th>
|
||||
<td id="ssid"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Camera Devices</th>
|
||||
<td id="camera"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Connected Devices</th>
|
||||
<td id="devices"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Zerotier IP</th>
|
||||
<td id="zerotier">N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Hotspot Connections</th>
|
||||
<td id="hotspot">N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">GCS</th>
|
||||
<td id="gcs">N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">FCU Firmware</th>
|
||||
<td id="fcu">N/A</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -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 += "<br>";
|
||||
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 += "<br>";
|
||||
}
|
||||
container.innerHTML += datalist[datalist.length - 1].split(" ")[0];
|
||||
}
|
||||
container.innerHTML += datalist[datalist.length - 1].split(" ")[0]
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
Loading…
Reference in New Issue