From 64822a68c76bbcc7b9f60c2bcd26380c3ed5608a Mon Sep 17 00:00:00 2001 From: Alice Sedgwick Date: Sun, 10 Nov 2024 02:13:25 -0500 Subject: [PATCH] trying to make a working dropdown --- ui/general/assets/{ => icons}/drone-icon.svg | 0 ui/general/health.html | 14 +++++++-- ui/general/health.js | 31 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) rename ui/general/assets/{ => icons}/drone-icon.svg (100%) diff --git a/ui/general/assets/drone-icon.svg b/ui/general/assets/icons/drone-icon.svg similarity index 100% rename from ui/general/assets/drone-icon.svg rename to ui/general/assets/icons/drone-icon.svg diff --git a/ui/general/health.html b/ui/general/health.html index ed9a7f0..e474b52 100644 --- a/ui/general/health.html +++ b/ui/general/health.html @@ -23,13 +23,21 @@
- Select a Drone for Inspection + Select a Drone for Inspection
- - +
diff --git a/ui/general/health.js b/ui/general/health.js index 8f3dacd..b754384 100644 --- a/ui/general/health.js +++ b/ui/general/health.js @@ -1,9 +1,40 @@ // Elements +const drone = document.getElementById("drone"); + +const drones = [ + // 2.4 GHz Channels + ["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() { + +} + +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); + }); }