Cleaned up Health page to remove dropdown, and delete any random code in the JS file
This commit is contained in:
parent
d11117844f
commit
8d2f837c01
@ -15,27 +15,8 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2 class="fw-bold">Health Status</h2>
|
||||
<p>At a glance view of the status of the drone.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<img src="assets/icons/drone-icon.svg" width="50px" height="50px" class="me-2"/><span>Select a Drone for Inspection</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="col-md-2">
|
||||
<img src="assets/icons/drone-icon.svg" class="me-2"/>
|
||||
<label for="composeFile" class="form-label"><b>Drone Select</b></label>
|
||||
<select id="droneSelection" class="form-select mt-2">
|
||||
<option value="L">SIODhosifdsiuf</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="card-header">
|
||||
<img src="assets/icons/drone-icon.svg" width="50px" height="50px" class="me-2"/><span>At a glance view of the status of the drone.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,27 +1,16 @@
|
||||
|
||||
// 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"],
|
||||
["4", "mu4"], ["5", "mu5"], ["6", "mu6"]
|
||||
]
|
||||
|
||||
// Load initial settings
|
||||
// Load page + drone settings
|
||||
document.onload = initPage();
|
||||
|
||||
droneDropdown.addEventListener("change", droneChange);
|
||||
|
||||
// Function to initialize the page
|
||||
function initPage() {
|
||||
// TODO: Replace /home/spiri/services with some root level path
|
||||
// Search for drones files in the services directory and populate the dropdown with directory names
|
||||
|
||||
addDropDown(droneDropdown, drones, "1");
|
||||
// Populate table with drone name, drone IP address, and drone docker containers that are running
|
||||
// Name corresponds to host computer's name, IP address is host computer's address
|
||||
// and docker containers are all those displayed by docker container ls
|
||||
const command1 = "hostname"
|
||||
const command2 = "hostname -I"
|
||||
const command3 = "docker container ls"
|
||||
@ -45,57 +34,4 @@ function initPage() {
|
||||
container.innerHTML += datalist[datalist.length - 1].split(" ")[0]
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
|
||||
function droneChange() {
|
||||
console.log(droneDropdown.value);
|
||||
return ;
|
||||
var drone1Table = "<table><tr><td>Drone1</td></tr></table>";
|
||||
var drone2Table = "<table><tr><td>Drone2</td></tr></table>";
|
||||
var drone3Table = "<table><tr><td>Drone3/td></tr></table>";
|
||||
var drone4Table = "<table><tr><td>Drone4</td></tr></table>";
|
||||
var drone5Table = "<table><tr><td>Drone5</td></tr></table>";
|
||||
switch(droneDropdown.value)
|
||||
{
|
||||
case "Drone1":
|
||||
document.getElementById("myTableContainer").innerHTML = drone1Table
|
||||
break;
|
||||
case "Drone2":
|
||||
document.getElementById("myTableContainer").innerHTML = drone2Table
|
||||
break;
|
||||
case "Drone3":
|
||||
document.getElementById("myTableContainer").innerHTML = drone3Table
|
||||
break;
|
||||
case "Drone4":
|
||||
document.getElementById("myTableContainer").innerHTML = drone4Table
|
||||
break;
|
||||
case "Drone5":
|
||||
document.getElementById("myTableContainer").innerHTML = drone5Table
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Restart drone service
|
||||
function displayDroneTable() {
|
||||
// upaate table
|
||||
;
|
||||
}
|
||||
|
||||
function addDropDown(box, pairs, defaultValue) {
|
||||
try {
|
||||
for(let i = 0; i < pairs.length; i++){
|
||||
if (pairs[i].length == 0 || pairs[i][0] === "" || pairs[i][1] === "") continue;
|
||||
const option = document.createElement("option");
|
||||
option.value = pairs[i][0];
|
||||
option.text = pairs[i][1];
|
||||
box.add(option);
|
||||
if (defaultValue === option.value) {
|
||||
box.value = option.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
displayFail(e)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user