I think the table works
This commit is contained in:
parent
957d0319df
commit
d11117844f
|
@ -2,6 +2,9 @@
|
||||||
// Elements
|
// Elements
|
||||||
const drone = document.getElementById("drone");
|
const drone = document.getElementById("drone");
|
||||||
const droneDropdown = document.getElementById("droneSelection");
|
const droneDropdown = document.getElementById("droneSelection");
|
||||||
|
const droneName = document.getElementById("name");
|
||||||
|
const address = document.getElementById("address");
|
||||||
|
const container = document.getElementById("container");
|
||||||
|
|
||||||
const drones = [
|
const drones = [
|
||||||
["1", "mu1"], ["2", "mu2"], ["3", "mu3"],
|
["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
|
// Search for drones files in the services directory and populate the dropdown with directory names
|
||||||
|
|
||||||
addDropDown(droneDropdown, drones, "1");
|
addDropDown(droneDropdown, drones, "1");
|
||||||
const command1 = "hostname -I"
|
const command1 = "hostname"
|
||||||
const command2 = "hostname"
|
const command2 = "hostname -I"
|
||||||
const command3 = "docker container ls"
|
const command3 = "docker container ls"
|
||||||
cockpit.spawn(["bash", "-c", command1])
|
cockpit.spawn(["bash", "-c", command1])
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log(data.split(" ")[0]);
|
droneName.innerHTML = data.split(" ")[0];
|
||||||
})
|
})
|
||||||
.catch((error) => console.log(error));
|
.catch((error) => console.log(error));
|
||||||
cockpit.spawn(["bash", "-c", command2])
|
cockpit.spawn(["bash", "-c", command2])
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log(data.split(" ")[0]);
|
address.innerHTML = data.split(" ")[0];
|
||||||
})
|
})
|
||||||
.catch((error) => console.log(error));
|
.catch((error) => console.log(error));
|
||||||
cockpit.spawn(["bash", "-c", command3])
|
cockpit.spawn(["bash", "-c", command3])
|
||||||
.then((data) => {
|
.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 += "<br>";
|
||||||
|
}
|
||||||
|
container.innerHTML += datalist[datalist.length - 1].split(" ")[0]
|
||||||
})
|
})
|
||||||
.catch((error) => console.log(error));
|
.catch((error) => console.log(error));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue