// Elements const drone = document.getElementById("drone"); const drones = [ ["1", "mu1"], ["2", "mu2"], ["3", "mu3"], ["4", "mu4"], ["5", "mu5"], ["6", "mu6"] ] // Load initial settings document.onload = initPage(); // 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 const currentDrone = getValueByKey(content, "common", "drone"); addDropDown(drone, drones, currentDrone); } function handleSelect(account) { var drone1Table = "
test
"; switch(account) { case "Drone1": document.getElementById("myTableContainer").innerHTML = drone1Table break; } } function dockerComposeFileChanged() { if (composeFileSelection.value === "") { populateEditor(""); return; } const composeLocation = composeFileSelection.value + "/docker-compose.yaml"; cockpit.file(composeLocation) .read().then((content) => successReadFile(content)) .catch(error => failureReadFile(error)); } function successReadFile(content) { try { // Drone selection const currentDrone = getValueByKey(content, "common", "drone"); addDropDown(drone, drones, currentDrone); } catch (e) { failureReadFile(e); } } // Restart wifibroadcast service function restartDroneDisplayService() { cockpit.spawn(["systemctl", "restart", "dronedisplay@drone"], { superuser: "require" }) .then(() => { displaySuccess("dronedisplay@drone service restarted."); }) .catch((error) => { console.error("Failed to restart dronedisplay@drone service:", error); displayFail("Failed to restart dronedisplay@drone service: " + error); }); }