attempt to fix dattoRMM sub items
This commit is contained in:
@@ -505,7 +505,13 @@ $style = @'
|
||||
// =======================================================================
|
||||
async function fetchSites() {
|
||||
const pwd = document.getElementById("Password").value;
|
||||
if (!pwd) { alert("Please enter the password."); return; }
|
||||
if (!pwd) {
|
||||
alert("Please enter the password.");
|
||||
return;
|
||||
}
|
||||
|
||||
const dropdown = document.getElementById("dattoDropdown");
|
||||
dropdown.innerHTML = '<option disabled selected>Loading sites...</option>';
|
||||
|
||||
try {
|
||||
const resp = await fetch("/getpw", {
|
||||
@@ -513,27 +519,31 @@ $style = @'
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ password: pwd })
|
||||
});
|
||||
|
||||
if (!resp.ok) throw("HTTP " + resp.status);
|
||||
|
||||
const sites = await resp.json();
|
||||
const dd = document.getElementById("dattoDropdown");
|
||||
dd.innerHTML = ""; // clear old
|
||||
sites.forEach(s => {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = s.UID;
|
||||
opt.text = s.Name;
|
||||
dd.appendChild(opt);
|
||||
dropdown.innerHTML = ''; // clear the loading message
|
||||
|
||||
sites.forEach(site => {
|
||||
const option = document.createElement("option");
|
||||
option.value = site.UID;
|
||||
option.textContent = site.Name;
|
||||
dropdown.appendChild(option);
|
||||
});
|
||||
|
||||
document.getElementById("dattoRmmContainer").style.display = "block";
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
dropdown.innerHTML = '<option disabled selected>Error loading sites</option>';
|
||||
alert("Failed to fetch sites. Check password and try again.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function triggerInstall() {
|
||||
for (const t of tasks) {
|
||||
const cb = document.getElementById(t.id);
|
||||
@@ -602,17 +612,13 @@ $htmlTemplate = @"
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 1) password & fetch button -->
|
||||
<div id="PasswordContainer" style="margin-bottom:1em;">
|
||||
<label for="Password">Password:</label>
|
||||
<input type="password" id="Password" placeholder="Enter password" />
|
||||
<button onclick="fetchSites()">Fetch Sites</button>
|
||||
</div>
|
||||
|
||||
<!-- 2) Datto RMM dropdown (populated after fetch) -->
|
||||
<div id="dattoRmmContainer" style="display:none; margin-bottom:1em;">
|
||||
<label for="dattoDropdown">Select Datto Site:</label>
|
||||
<select id="dattoDropdown"></select>
|
||||
<select id="dattoDropdown">
|
||||
<option disabled selected hidden>Select a site...</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="offboardTab" class="tab-content">
|
||||
|
||||
Reference in New Issue
Block a user