25 lines
753 B
JavaScript
25 lines
753 B
JavaScript
// static/js/wizard/step3_deploy.js
|
|
export function mountStep3Deploy() {
|
|
const btn = document.getElementById('btn-run-gaf');
|
|
const outputDiv = document.getElementById('gaf-output');
|
|
if (!btn || !outputDiv) return;
|
|
|
|
btn.onclick = null;
|
|
btn.addEventListener('click', async () => {
|
|
btn.disabled = true;
|
|
btn.textContent = 'Running…';
|
|
outputDiv.textContent = '';
|
|
try {
|
|
const res = await fetch('/api/ansible/deploy', { method: 'POST' });
|
|
const text = await res.text();
|
|
outputDiv.textContent = text;
|
|
btn.textContent = 'Run';
|
|
btn.disabled = false;
|
|
} catch (err) {
|
|
outputDiv.textContent = `Error: ${err.message || err}`;
|
|
btn.textContent = 'Run';
|
|
btn.disabled = false;
|
|
}
|
|
});
|
|
}
|