(newMode)
| 17574 | lastPwnState = pwnStatus.state; |
| 17575 | } |
| 17576 | |
| 17577 | function updatePwnHealthCard(status = {}) { |
| 17578 | const card = document.getElementById('pwn-health-card'); |
| 17579 | if (!card) { |
| 17580 | return; |
| 17581 | } |
| 17582 | |
| 17583 | const components = status.components || {}; |
| 17584 | const labels = status.component_labels || {}; |
| 17585 | const order = (status.component_order && status.component_order.length) |
| 17586 | ? status.component_order |
| 17587 | : Object.keys(labels); |
| 17588 | const anyComponent = order.some(key => components[key]); |
| 17589 | |
| 17590 | // Only meaningful once something is on disk; otherwise the Install card |
| 17591 | // already tells the user Pwnagotchi isn't set up yet. |
| 17592 | if (!(status.installed || anyComponent)) { |
| 17593 | card.style.display = 'none'; |
| 17594 | return; |
| 17595 | } |
| 17596 | card.style.display = ''; |
| 17597 | |
| 17598 | const list = document.getElementById('pwn-health-list'); |
| 17599 | if (list) { |
| 17600 | list.innerHTML = order.map(key => { |
| 17601 | const ok = Boolean(components[key]); |
| 17602 | const icon = ok |
| 17603 | ? '<span class="text-green-400 font-bold">✓</span>' |
| 17604 | : '<span class="text-red-400 font-bold">✗</span>'; |
| 17605 | const rowClass = ok ? 'text-gray-300' : 'text-red-300'; |
| 17606 | return `<li class="flex items-center gap-2 ${rowClass}">${icon}<span>${escapeHtml(labels[key] || key)}</span></li>`; |
| 17607 | }).join(''); |
| 17608 | } |
| 17609 | |
| 17610 | const missingCritical = status.missing_critical || []; |
nothing calls this directly
no test coverage detected