v1.9.11: Bouton 'Test Power Supply' (check sous-tension rapide)
Ajoute un bouton à côté de 'Run Self Test' (4 pages) qui lance uniquement le check sous-tension dans un petit modal dédié, sans dérouler tout le Self Test. Réutilise l'endpoint type=throttled. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.9.11",
|
||||
"date": "2026-05-28",
|
||||
"changes": {
|
||||
"features": [
|
||||
"Bouton 'Test Power Supply' à côté de 'Run Self Test' (pages Admin, Accueil, Capteurs, Modem) : lance uniquement le check sous-tension dans un petit modal dédié, sans dérouler tout le Self Test. Affiche le verdict (OK / Warning / Failed) + le détail des bits (sous-tension maintenant / depuis le boot, throttling)."
|
||||
],
|
||||
"improvements": [],
|
||||
"fixes": [],
|
||||
"compatibility": []
|
||||
},
|
||||
"notes": "Réutilise l'endpoint launcher.php?type=throttled ajouté en v1.9.10. Le modal est défini dans selftest-modal.html (déjà chargé sur toutes les pages)."
|
||||
},
|
||||
{
|
||||
"version": "1.9.10",
|
||||
"date": "2026-05-28",
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
Run Self Test
|
||||
</button>
|
||||
|
||||
<button class="btn btn-outline-success mb-3 ms-2 btn_powerTest" onclick="runPowerTest()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightning-charge me-1" viewBox="0 0 16 16">
|
||||
<path d="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"/>
|
||||
</svg>
|
||||
Test Power Supply
|
||||
</button>
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
<div class="col-lg-3 col-12">
|
||||
|
||||
@@ -1025,6 +1025,65 @@ function downloadReport() {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// STANDALONE POWER SUPPLY TEST (quick check)
|
||||
// ============================================
|
||||
function runPowerTest() {
|
||||
const modalEl = document.getElementById('powerTestModal');
|
||||
const bodyEl = document.getElementById('powerTest_body');
|
||||
|
||||
bodyEl.innerHTML = `
|
||||
<div class="d-flex align-items-center text-primary">
|
||||
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
||||
<span>Lecture de l'alimentation (vcgencmd get_throttled)...</span>
|
||||
</div>`;
|
||||
|
||||
const modal = bootstrap.Modal.getOrCreateInstance(modalEl);
|
||||
modal.show();
|
||||
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=throttled',
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
cache: false,
|
||||
timeout: 10000,
|
||||
success: function(data) { renderPowerTestResult(bodyEl, data); },
|
||||
error: function(xhr, status, error) {
|
||||
bodyEl.innerHTML = `<div class="alert alert-secondary mb-0">Erreur: ${error || status}</div>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderPowerTestResult(bodyEl, data) {
|
||||
if (!data || !data.available) {
|
||||
bodyEl.innerHTML = `<div class="alert alert-secondary mb-0">${(data && data.error) || 'vcgencmd indisponible'}</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
let alertClass, icon;
|
||||
if (data.status === 'critical') { alertClass = 'alert-danger'; icon = '✗'; }
|
||||
else if (data.status === 'warning') { alertClass = 'alert-warning'; icon = '!'; }
|
||||
else { alertClass = 'alert-success'; icon = '✓'; }
|
||||
|
||||
const flag = (b) => b
|
||||
? '<span class="badge bg-danger">oui</span>'
|
||||
: '<span class="badge bg-success">non</span>';
|
||||
|
||||
bodyEl.innerHTML = `
|
||||
<div class="alert ${alertClass}">
|
||||
<strong>${icon} ${data.message}</strong>
|
||||
</div>
|
||||
<table class="table table-sm mb-0">
|
||||
<tbody>
|
||||
<tr><td>Valeur brute</td><td><code>${data.raw}</code></td></tr>
|
||||
<tr><td>Sous-tension maintenant</td><td>${flag(data.under_voltage_now)}</td></tr>
|
||||
<tr><td>Throttling maintenant</td><td>${flag(data.throttled_now)}</td></tr>
|
||||
<tr><td>Sous-tension depuis le boot</td><td>${flag(data.under_voltage_occurred)}</td></tr>
|
||||
<tr><td>Throttling depuis le boot</td><td>${flag(data.throttling_occurred)}</td></tr>
|
||||
</tbody>
|
||||
</table>`;
|
||||
}
|
||||
|
||||
// Load the self-test modal HTML into the page
|
||||
function initSelfTestModal() {
|
||||
fetch('selftest-modal.html')
|
||||
|
||||
@@ -71,6 +71,13 @@
|
||||
Run Self Test
|
||||
</button>
|
||||
|
||||
<button class="btn btn-outline-success mb-3 ms-2 btn_powerTest" onclick="runPowerTest()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightning-charge me-1" viewBox="0 0 16 16">
|
||||
<path d="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"/>
|
||||
</svg>
|
||||
Test Power Supply
|
||||
</button>
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
<!-- Card NPM values -->
|
||||
|
||||
@@ -76,6 +76,13 @@
|
||||
Run Self Test
|
||||
</button>
|
||||
|
||||
<button class="btn btn-outline-success mb-3 ms-2 btn_powerTest" onclick="runPowerTest()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightning-charge me-1" viewBox="0 0 16 16">
|
||||
<path d="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"/>
|
||||
</svg>
|
||||
Test Power Supply
|
||||
</button>
|
||||
|
||||
<span id="modem_status_message"></span>
|
||||
<!--
|
||||
<h3>
|
||||
|
||||
@@ -104,6 +104,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Power Supply Test Modal (standalone quick check) -->
|
||||
<div class="modal fade" id="powerTestModal" tabindex="-1" aria-labelledby="powerTestModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="powerTestModalLabel">Power Supply Test</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="powerTest_body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-primary" onclick="runPowerTest()">Re-tester</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Share Report Modal -->
|
||||
<div class="modal fade" id="shareReportModal" tabindex="-1" aria-labelledby="shareReportModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
|
||||
@@ -71,6 +71,13 @@
|
||||
Run Self Test
|
||||
</button>
|
||||
|
||||
<button class="btn btn-outline-success mb-3 ms-2 btn_powerTest" onclick="runPowerTest()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightning-charge me-1" viewBox="0 0 16 16">
|
||||
<path d="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"/>
|
||||
</svg>
|
||||
Test Power Supply
|
||||
</button>
|
||||
|
||||
<div class="row mb-3" id="card-container"></div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user