Still looking at getting a dropdown working

This commit is contained in:
Alice Sedgwick 2024-11-11 02:06:30 -05:00
parent 4c6b679bab
commit 364cb5f85a
2 changed files with 20 additions and 0 deletions

View File

@ -57,6 +57,11 @@
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</div>
<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"></select>
</div>
</div>
</div>
</div>

View File

@ -13,7 +13,22 @@ 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 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) {