From 8432a44574958231300b71ccd5885425364d735c Mon Sep 17 00:00:00 2001 From: Rene Fichtmueller Date: Fri, 5 Jun 2026 22:38:52 +0000 Subject: [PATCH] fix(dashboard): fmtSpd() all speed displays -- 1.00G->1G, 400.00G->400G, 1600->1.6T --- packages/dashboard/index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/dashboard/index.html b/packages/dashboard/index.html index b1040ea..6bf38d1 100644 --- a/packages/dashboard/index.html +++ b/packages/dashboard/index.html @@ -5197,7 +5197,7 @@ function searchSwitches() { buildDOM(el('sw-table'), items.map(function(s) { var catColors = { DataCenter: 'b-blue', Campus: 'b-green', SP: 'b-purple', Core: 'b-orange', Edge: 'b-cyan', Industrial: 'b-yellow' }; var statusColors = { Active: 'b-green', 'EoS_Announced': 'b-yellow', EoL: 'b-red', Legacy: 'b-neutral' }; - var maxSpd = s.max_speed_gbps >= 1000 ? (s.max_speed_gbps/1000) + 'T' : s.max_speed_gbps + 'G'; + var maxSpd = fmtSpd(s.max_speed_gbps); var cap = s.switching_capacity_tbps ? s.switching_capacity_tbps + ' Tbps' : '—'; // Thumbnail — show image if available, otherwise a switch icon var thumb = s.image_url @@ -5266,7 +5266,7 @@ async function openSwitchDetail(id) { h += '
Category
' + esc(s.category || '—') + '
'; h += '
Total Ports
' + esc(s.total_ports || '—') + '
'; h += '
Switching Capacity
' + (s.switching_capacity_tbps ? s.switching_capacity_tbps + ' Tbps' : '—') + '
'; - h += '
Max Speed
' + (s.max_speed_gbps >= 1000 ? (s.max_speed_gbps/1000) + 'T' : (s.max_speed_gbps || '—') + 'G') + '
'; + h += '
Max Speed
' + (fmtSpd(s.max_speed_gbps)) + '
'; h += ''; h += '
Specifications
'; @@ -5870,7 +5870,7 @@ async function loadStandardsList() { var ff = Array.isArray(s.form_factors) ? s.form_factors[0] : (s.form_factors || s.form_factor || ''); return '' - + esc((s.speed_gbps ? s.speed_gbps + 'G ' : '') + (ff || s.name || s.category || '')) + + esc((s.speed_gbps ? fmtSpd(s.speed_gbps) + ' ' : '') + (ff || s.name || s.category || '')) + ''; }).join('') + ''; @@ -5941,7 +5941,7 @@ function renderFormFactors(items) { var sCl = statusColors[f.status] || '#888'; var fCl = familyColors[f.family] || '#888'; var sLbl = statusLabels[f.status] || f.status || ''; - var maxSpd = f.max_speed_gbps >= 1000 ? (f.max_speed_gbps/1000) + 'T' : (f.max_speed_gbps || '?') + 'G'; + var maxSpd = fmtSpd(f.max_speed_gbps); // Description: show first part (DE) if bilingual var descFull = f.description || ''; var descDE = descFull.split('//')[0].trim(); @@ -6060,7 +6060,7 @@ async function openFormFactorDetail(name) { var descFull = f.description || ''; var descDE = descFull.split('//')[0].trim(); var descEN = descFull.includes('//') ? descFull.split('//')[1].trim() : ''; - var maxSpd = f.max_speed_gbps >= 1000 ? (f.max_speed_gbps/1000) + 'T' : (f.max_speed_gbps || '?') + 'G'; + var maxSpd = fmtSpd(f.max_speed_gbps); var supersedes = Array.isArray(f.supersedes) ? f.supersedes.filter(Boolean) : []; var hype = FF_HYPE[f.name] || { phase:'—', pct:50, signal:'—', sigCol:'#888', sigLbl:'Keine Daten' }; var useCases = FF_USE_CASES[f.name] || []; @@ -6922,7 +6922,7 @@ async function runFinder() { '
' + sw.vendor + ' ' + sw.model + '
' + '
' + (sw.series ? sw.series + ' · ' : '') + - 'Max speed: ' + (sw.max_speed_gbps || '?') + 'G' + + 'Max speed: ' + fmtSpd(sw.max_speed_gbps) + '
' + '' + '
' + @@ -12275,7 +12275,7 @@ async function openSignalPriceChart(txId, partNumber) { var d = await (await fetch('/api/price-history/' + txId + '?days=180', { headers: { 'Authorization': 'Bearer ' + tok } })).json(); var tx = d.transceiver || {}; document.getElementById('ph-title').textContent = 'Price History — ' + (tx.part_number || partNumber || txId) - + (tx.form_factor ? ' (' + tx.form_factor + (tx.speed_gbps ? ' · ' + tx.speed_gbps + 'G' : '') + ')' : ''); + + (tx.form_factor ? ' (' + tx.form_factor + (tx.speed_gbps ? ' · ' + fmtSpd(tx.speed_gbps) : '') + ')' : ''); var series = d.series || []; if (!series.length) {