Add API endpoint to clear status and update UI with hints for golden image handling in eMMC provisioning dashboard

This commit is contained in:
nearxos
2026-02-18 14:29:38 +02:00
parent c42e7951d0
commit ccdace36bc
2 changed files with 30 additions and 0 deletions

View File

@@ -368,6 +368,10 @@
<span id="statusMsg" class="status-msg">Waiting for device</span>
</div>
<div id="statusErr" class="status-err" style="display:none;"></div>
<div id="statusGoldenHint" class="backup-deploy-hint" style="display:none; margin-top:0.75rem;">
No golden image is required to <strong>capture</strong>. Connect a device in USB boot mode (or register over network); when it appears under “Capture image or deploy”, click <strong>Backup</strong> to save its image. Then set that backup as golden in the list below.
<button type="button" id="statusClearBtn" class="btn btn-outline btn-sm" style="margin-left:0.5rem;">Clear message</button>
</div>
<div id="statusMeta" class="status-meta" style="display:none;"></div>
<div id="progressWrap" class="progress-track" style="display:none;">
<div id="progressFill" class="progress-fill"></div>
@@ -467,6 +471,12 @@
statusErr.style.display = 'none';
}
var goldenHint = document.getElementById('statusGoldenHint');
if (goldenHint) {
var isGoldenError = phase === 'error' && /golden|Golden image/i.test((data.error || '') + (data.message || ''));
goldenHint.style.display = isGoldenError ? 'block' : 'none';
}
if (data.updated) {
statusMeta.textContent = 'Updated ' + data.updated;
statusMeta.style.display = 'block';
@@ -670,6 +680,10 @@
return d.innerHTML;
}
document.getElementById('statusClearBtn').addEventListener('click', function() {
fetch('/api/status-clear', { method: 'POST' }).then(function(r) { return r.json(); }).then(function(d) { if (d.ok) fetchStatus(); });
});
fetchStatus();
fetchLog();
fetchPending();