Update StackMonkey.ps1
This commit is contained in:
@@ -854,9 +854,34 @@ $style = @'
|
||||
async function triggerInstall() {
|
||||
for (const t of tasks) {
|
||||
const cb = document.getElementById(t.id);
|
||||
if (cb && cb.checked) {
|
||||
if (!cb || !cb.checked) continue;
|
||||
|
||||
// special-case DattoRMM: POST JSON with sub-options + site info
|
||||
if (t.id === 'installDattoRMM') {
|
||||
const checkedValues = Array.from(
|
||||
document.querySelectorAll('.sub-option-installDattoRMM')
|
||||
)
|
||||
.filter(sub => sub.checked)
|
||||
.map(sub => sub.value);
|
||||
|
||||
const dropdown = document.getElementById('dattoDropdown');
|
||||
const UID = dropdown.value;
|
||||
const Name = dropdown.options[dropdown.selectedIndex].text;
|
||||
|
||||
try {
|
||||
await fetch(t.handler, { method: "GET" });
|
||||
await fetch('/installDattoRMM', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ checkedValues, UID, Name })
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(`Error running ${t.label}:`, e);
|
||||
}
|
||||
|
||||
} else {
|
||||
// everything else remains a simple GET
|
||||
try {
|
||||
await fetch(t.handler, { method: 'GET' });
|
||||
} catch (e) {
|
||||
console.error(`Error running ${t.label}:`, e);
|
||||
}
|
||||
@@ -864,6 +889,7 @@ $style = @'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// Shutdown Handler
|
||||
// =======================================================================
|
||||
|
||||
Reference in New Issue
Block a user