set the run button to gray out until script is done
This commit is contained in:
@@ -856,16 +856,21 @@ $style = @'
|
||||
|
||||
|
||||
|
||||
const runBtn = document.querySelector('.run-button');
|
||||
|
||||
async function triggerInstall() {
|
||||
// disable the button so you can’t double‐click while work is in flight
|
||||
runBtn.disabled = true;
|
||||
|
||||
try {
|
||||
for (const t of tasks) {
|
||||
const cb = document.getElementById(t.id);
|
||||
if (!cb || !cb.checked) continue;
|
||||
|
||||
// special case: DattoRMM is POST
|
||||
if (t.id === 'installDattoRMM') {
|
||||
const sub = Array.from(
|
||||
document.querySelectorAll('.sub-option-installDattoRMM:checked')
|
||||
).map(x=>x.value);
|
||||
).map(x => x.value);
|
||||
const dropdown = document.getElementById('dattoDropdown');
|
||||
const uid = dropdown.value;
|
||||
const name = dropdown.selectedOptions[0].text;
|
||||
@@ -879,13 +884,18 @@ $style = @'
|
||||
Name: name
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
// your existing GET for everyone else
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user