attempted to install-dattormm
This commit is contained in:
@@ -870,53 +870,49 @@ catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function triggerInstall() {
|
||||
// disable the button so you can't double-click while work is in flight
|
||||
const runBtn = document.querySelector('.run-button');
|
||||
runBtn.disabled = true;
|
||||
|
||||
try {
|
||||
// 1. If installDattoRMM is selected, run it first
|
||||
const dattoCB = document.getElementById('installDattoRMM');
|
||||
if (dattoCB && dattoCB.checked) {
|
||||
const sub = Array.from(
|
||||
document.querySelectorAll('.sub-option-installDattoRMM:checked')
|
||||
).map(x => x.value);
|
||||
const dropdown = document.getElementById('dattoDropdown');
|
||||
const uid = dropdown.value;
|
||||
const name = dropdown.selectedOptions[0].text;
|
||||
|
||||
await fetch('/installDattoRMM', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
checkedValues: sub,
|
||||
UID: uid,
|
||||
Name: name
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 2. Now run everything else
|
||||
for (const t of tasks) {
|
||||
if (t.id === 'installDattoRMM') continue;
|
||||
|
||||
const cb = document.getElementById(t.id);
|
||||
if (!cb || !cb.checked) continue;
|
||||
|
||||
if (t.id === 'installDattoRMM') {
|
||||
const sub = Array.from(
|
||||
document.querySelectorAll('.sub-option-installDattoRMM:checked')
|
||||
).map(x => x.value);
|
||||
const dropdown = document.getElementById('dattoDropdown');
|
||||
const uid = dropdown.value;
|
||||
const name = dropdown.selectedOptions[0].text;
|
||||
|
||||
await fetch('/installDattoRMM', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
checkedValues: sub,
|
||||
UID: uid,
|
||||
Name: name
|
||||
})
|
||||
});
|
||||
} else {
|
||||
await fetch(t.handler, { method: 'GET' });
|
||||
}
|
||||
await fetch(t.handler, { method: 'GET' });
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error during triggerInstall:', e);
|
||||
} finally {
|
||||
// always re-enable, even if an error occurred
|
||||
runBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// Shutdown Handler
|
||||
// =======================================================================
|
||||
|
||||
Reference in New Issue
Block a user