attempted to install-dattormm

This commit is contained in:
2025-07-09 17:16:19 -04:00
parent 5d8e3263c6
commit 70c14a0ec2

View File

@@ -870,22 +870,14 @@ catch (e) {
} }
} }
async function triggerInstall() { async function triggerInstall() {
// disable the button so you can't double-click while work is in flight
const runBtn = document.querySelector('.run-button'); const runBtn = document.querySelector('.run-button');
runBtn.disabled = true; runBtn.disabled = true;
try { try {
for (const t of tasks) { // 1. If installDattoRMM is selected, run it first
const cb = document.getElementById(t.id); const dattoCB = document.getElementById('installDattoRMM');
if (!cb || !cb.checked) continue; if (dattoCB && dattoCB.checked) {
if (t.id === 'installDattoRMM') {
const sub = Array.from( const sub = Array.from(
document.querySelectorAll('.sub-option-installDattoRMM:checked') document.querySelectorAll('.sub-option-installDattoRMM:checked')
).map(x => x.value); ).map(x => x.value);
@@ -902,21 +894,25 @@ async function triggerInstall() {
Name: name Name: name
}) })
}); });
} else {
await fetch(t.handler, { method: 'GET' });
} }
// 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;
await fetch(t.handler, { method: 'GET' });
} }
} catch (e) { } catch (e) {
console.error('Error during triggerInstall:', e); console.error('Error during triggerInstall:', e);
} finally { } finally {
// always re-enable, even if an error occurred
runBtn.disabled = false; runBtn.disabled = false;
} }
} }
// ======================================================================= // =======================================================================
// Shutdown Handler // Shutdown Handler
// ======================================================================= // =======================================================================