|
1056 | 1056 | font-family: "Share Tech Mono", monospace; |
1057 | 1057 | } |
1058 | 1058 |
|
| 1059 | + /* system information table */ |
| 1060 | + .cp-info-table th { |
| 1061 | + white-space: nowrap; |
| 1062 | + width: 1%; |
| 1063 | + padding-right: 18px; |
| 1064 | + color: var(--cp-cyan); |
| 1065 | + font-weight: 600; |
| 1066 | + } |
| 1067 | + |
| 1068 | + .cp-info-table td { |
| 1069 | + word-break: break-word; |
| 1070 | + color: var(--cp-text, #cfe9ff); |
| 1071 | + } |
| 1072 | + |
| 1073 | + .cp-info-table tr+tr th, |
| 1074 | + .cp-info-table tr+tr td { |
| 1075 | + border-top: 1px solid var(--cp-border); |
| 1076 | + } |
| 1077 | + |
1059 | 1078 | /* ---------- toasts ---------- */ |
1060 | 1079 | .toast { |
1061 | 1080 | background: var(--cp-panel); |
|
1441 | 1460 | <div class="modal-header"> |
1442 | 1461 | <h5 class="modal-title" data-i18n="infos"></h5> |
1443 | 1462 | </div> |
1444 | | - <div class="modal-body" style="white-space: pre" id="modalInfoContent"> |
| 1463 | + <div class="modal-body" id="modalInfoContent"> |
1445 | 1464 | </div> |
1446 | 1465 | <div class="modal-footer"> |
1447 | 1466 | <button type="button" id="modalInfoRefresh" class="btn btn-primary me-auto"><i |
@@ -5442,76 +5461,38 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5> |
5442 | 5461 | async function fetchInfo() { |
5443 | 5462 | let info = await (await fetch("http://" + host + "/info")).json(); |
5444 | 5463 | console.log(info); |
5445 | | - let content = i18next.t("systeminfo.softwareversion", { |
5446 | | - softwareversion: info.software.version |
5447 | | - }) + "<br>"; |
5448 | | - content += i18next.t("systeminfo.gitversion", { |
5449 | | - gitversion: info.software.git |
5450 | | - }) + "<br>"; |
5451 | | - content += i18next.t("systeminfo.arduinoversion", { |
5452 | | - arduinoversion: info.software.arduino, |
5453 | | - idfversion: info.software.idf |
5454 | | - }) + "<br>"; |
5455 | | - content += i18next.t("systeminfo.hardware", { |
5456 | | - hwmodel: info.hardware.model, |
5457 | | - hwrevision: info.hardware.revision, |
5458 | | - hwfreq: info.hardware.freq |
5459 | | - }) + "<br>"; |
5460 | | - content += i18next.t("systeminfo.freeheap", { |
5461 | | - freeheap: info.memory.freeHeap |
5462 | | - }) + "<br>"; |
5463 | | - content += i18next.t("systeminfo.largestfreeblock", { |
5464 | | - largestfreeblock: info.memory.largestFreeBlock |
5465 | | - }) + "<br>"; |
5466 | | - if (info.memory.freePSRam) { |
5467 | | - content += i18next.t("systeminfo.freepsram", { |
5468 | | - freepsram: info.memory.freePSRam |
5469 | | - }) + "<br>"; |
5470 | | - } |
5471 | | - content += i18next.t("systeminfo.currentip", { |
5472 | | - currentip: info.wifi.ip |
5473 | | - }) + "<br>"; |
5474 | | - content += i18next.t("systeminfo.macAddress", { |
5475 | | - macAddress: info.wifi.macAddress |
5476 | | - }) + "<br>"; |
5477 | | - content += i18next.t("systeminfo.rssi", { |
5478 | | - rssi: info.wifi.rssi |
5479 | | - }) + "<br>"; |
5480 | | - content += i18next.t("systeminfo.audiotimetotal", { |
5481 | | - firststart: secondsToDate(info.audio.firstStart), |
5482 | | - audiotimetotal: timestampToDuration(info.audio.playtimeTotal, false) |
5483 | | - }) + "<br>"; |
5484 | | - if (info.audio.playtimeSinceStart > 0) { |
5485 | | - content += i18next.t("systeminfo.audiotimesincestart", { |
5486 | | - audiotimesincestart: timestampToDuration(info.audio.playtimeSinceStart, true) |
5487 | | - }) + "<br>"; |
5488 | | - } |
5489 | | - if (info.sdcard && info.sdcard.size) { |
5490 | | - content += i18next.t("systeminfo.sdcard", { |
5491 | | - free: (info.sdcard.free / 1024).toFixed(1), |
5492 | | - total: (info.sdcard.size / 1024).toFixed(1) |
5493 | | - }) + "<br>"; |
5494 | | - } |
| 5464 | + const esc = (typeof escapeHtml === 'function') ? escapeHtml : function (x) { return x; }; |
| 5465 | + const num = function (n) { return Number(n).toLocaleString(); }; |
| 5466 | + const rows = []; |
| 5467 | + const add = function (labelKey, value) { |
| 5468 | + if (value === undefined || value === null || value === '') return; |
| 5469 | + rows.push('<tr><th scope="row">' + i18next.t(labelKey) + '</th><td>' + esc(String(value)) + '</td></tr>'); |
| 5470 | + }; |
| 5471 | + |
| 5472 | + add('systeminfo.lblSoftware', info.software.version); |
| 5473 | + add('systeminfo.lblGit', info.software.git); |
| 5474 | + add('systeminfo.lblEnv', info.software.arduino + ' / ' + info.software.idf); |
| 5475 | + add('systeminfo.lblChip', info.hardware.model + ' (rev ' + info.hardware.revision + ')'); |
| 5476 | + add('systeminfo.lblCpu', info.hardware.freq + ' MHz'); |
| 5477 | + if (info.hardware.readerFirmware) add('systeminfo.lblReader', 'PN5180 ' + info.hardware.readerFirmware); |
| 5478 | + add('systeminfo.lblHeap', num(info.memory.freeHeap) + ' B'); |
| 5479 | + add('systeminfo.lblHeapBlock', num(info.memory.largestFreeBlock) + ' B'); |
| 5480 | + if (info.memory.freePSRam) add('systeminfo.lblPsram', num(info.memory.freePSRam) + ' B'); |
| 5481 | + add('systeminfo.lblIp', info.wifi.ip); |
| 5482 | + add('systeminfo.lblMac', info.wifi.macAddress); |
| 5483 | + add('systeminfo.lblRssi', info.wifi.rssi + ' dBm'); |
| 5484 | + add('systeminfo.lblSince', secondsToDate(info.audio.firstStart)); |
| 5485 | + add('systeminfo.lblPlayTotal', timestampToDuration(info.audio.playtimeTotal, false)); |
| 5486 | + if (info.audio.playtimeSinceStart > 0) add('systeminfo.lblPlaySince', timestampToDuration(info.audio.playtimeSinceStart, true)); |
| 5487 | + if (info.sdcard && info.sdcard.size) add('systeminfo.lblSd', (info.sdcard.free / 1024).toFixed(1) + ' / ' + (info.sdcard.size / 1024).toFixed(1) + ' GB'); |
5495 | 5488 | if (info.battery) { |
5496 | | - content += i18next.t("systeminfo.currvoltage", { |
5497 | | - currvoltage: info.battery.currVoltage.toFixed(2) |
5498 | | - }) + "<br>"; |
5499 | | - if (info.battery.chargelevel) { |
5500 | | - content += i18next.t("systeminfo.chargelevel", { |
5501 | | - chargelevel: info.battery.chargeLevel.toFixed(1) |
5502 | | - }) + "<br>"; |
5503 | | - } |
| 5489 | + add('systeminfo.lblVoltage', info.battery.currVoltage.toFixed(2) + ' V'); |
| 5490 | + if (info.battery.chargeLevel) add('systeminfo.lblCharge', info.battery.chargeLevel.toFixed(1) + ' %'); |
5504 | 5491 | } |
5505 | | - if (info.hallsensor) { |
5506 | | - content += i18next.t("systeminfo.hallsensor", { |
5507 | | - hsnullfieldvalue: info.hallsensor.nullFieldValue, |
5508 | | - hsactual: info.hallsensor.actual, |
5509 | | - hsdiff: info.hallsensor.diff, |
5510 | | - hslastwaitforstate: info.hallsensor.lastWaitState, |
5511 | | - hswaited: info.hallsensor.lastWaitMS |
5512 | | - }) + "<br>"; |
5513 | | - } |
5514 | | - $('#modalInfoContent').html(content); |
| 5492 | + if (info.hallsensor) add('systeminfo.lblHall', 'null ' + info.hallsensor.nullFieldValue + ', actual ' + info.hallsensor.actual + ', diff ' + info.hallsensor.diff); |
| 5493 | + |
| 5494 | + const html = '<table class="table table-sm table-borderless cp-info-table mb-0"><tbody>' + rows.join('') + '</tbody></table>'; |
| 5495 | + $('#modalInfoContent').html(html); |
5515 | 5496 | } |
5516 | 5497 | var liveLogInterval; |
5517 | 5498 | async function fetchLog() { |
|
0 commit comments