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