attempted to install-dattormm
This commit is contained in:
@@ -870,53 +870,49 @@ 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 {
|
||||||
|
// 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) {
|
for (const t of tasks) {
|
||||||
|
if (t.id === 'installDattoRMM') continue;
|
||||||
|
|
||||||
const cb = document.getElementById(t.id);
|
const cb = document.getElementById(t.id);
|
||||||
if (!cb || !cb.checked) continue;
|
if (!cb || !cb.checked) continue;
|
||||||
|
|
||||||
if (t.id === 'installDattoRMM') {
|
await fetch(t.handler, { method: 'GET' });
|
||||||
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' });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} 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
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user