Review changes

This commit is contained in:
jpirnay
2026-04-09 13:33:20 +02:00
parent 91d5280a05
commit 32d44eb158
3 changed files with 16 additions and 7 deletions
@@ -126,7 +126,7 @@ void SystemInformationActivity::render(RenderLock&&) {
drawRow(9, tr(STR_SD_CARD), tr(STR_NOT_SET));
}
const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_UPDATE), "", "");
const auto labels = mappedInput.mapLabels(tr(STR_BACK), sdStatusReady_ ? "" : tr(STR_UPDATE), "", "");
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
renderer.displayBuffer();
+14 -5
View File
@@ -215,6 +215,13 @@
return parseFloat(val.toFixed(2)).toLocaleString() + ' ' + units[i];
}
const SD_LABELS = {
NOT_LOADED: 'Not loaded',
LOAD_BUTTON: 'Load SD info',
LOADING: 'Loading...',
ERROR: 'Error loading'
};
function formatUptime(seconds) {
if (seconds == null) return 'N/A';
const h = Math.floor(seconds / 3600);
@@ -255,7 +262,7 @@
? formatBytes(data.sdUsed) + ' / ' + formatBytes(data.sdTotal)
: 'N/A';
} else {
document.getElementById('sd-space').textContent = 'Not loaded';
document.getElementById('sd-space').textContent = SD_LABELS.NOT_LOADED;
}
}
@@ -270,14 +277,15 @@
setSdButtonState(true);
} catch (error) {
console.error('Error fetching status:', error);
document.getElementById('sd-space').textContent = SD_LABELS.ERROR;
}
}
async function fetchSdStatus() {
const button = document.getElementById('load-sd-button');
button.disabled = true;
button.textContent = 'Loading...';
document.getElementById('sd-space').textContent = 'Loading...';
button.textContent = SD_LABELS.LOADING;
document.getElementById('sd-space').textContent = SD_LABELS.LOADING;
try {
const response = await fetch('/api/status');
@@ -290,14 +298,15 @@
} catch (error) {
console.error('Error fetching SD status:', error);
button.disabled = false;
button.textContent = 'Load SD info';
button.textContent = SD_LABELS.LOAD_BUTTON;
document.getElementById('sd-space').textContent = SD_LABELS.ERROR;
}
}
function setSdButtonState(enabled) {
const button = document.getElementById('load-sd-button');
button.disabled = !enabled;
button.textContent = enabled ? 'Load SD info' : 'Loading...';
button.textContent = enabled ? SD_LABELS.LOAD_BUTTON : SD_LABELS.LOADING;
}
document.addEventListener('DOMContentLoaded', () => {