feat: improve styling, add more infos to node cards

This commit is contained in:
2025-09-20 13:28:10 +02:00
parent e4cfb77a67
commit 22adf7d65f
5 changed files with 165 additions and 7 deletions

View File

@@ -25,6 +25,22 @@ class NodeDetailsComponent extends Component {
return (r << 16) + (g << 8) + b;
}
// Format flash size in human readable format
formatFlashSize(bytes) {
if (!bytes || bytes === 0) return 'Unknown';
const units = ['B', 'KB', 'MB', 'GB'];
let size = bytes;
let unitIndex = 0;
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024;
unitIndex++;
}
return `${size.toFixed(1)} ${units[unitIndex]}`;
}
// Parameter component renderers
renderSelectComponent(p, formId, pidx) {
return `<select id="${formId}-field-${pidx}" data-param-name="${p.name}" data-param-location="${p.location || 'body'}" data-param-type="${p.type || 'string'}" data-param-required="${p.required ? '1' : '0'}" class="param-input">${p.values.map(v => `<option value="${v}">${v}</option>`).join('')}</select>`;
@@ -333,7 +349,7 @@ class NodeDetailsComponent extends Component {
</div>
<div class="detail-row">
<span class="detail-label">Flash Size:</span>
<span class="detail-value">${Math.round(nodeStatus.flashChipSize / 1024)}KB</span>
<span class="detail-value">${this.formatFlashSize(nodeStatus.flashChipSize)}</span>
</div>
`;