feat: switch facts — migration 040 seeds power/weight/certifications + dashboard shows them

- Migration 040: seeds rack_units, typical_power_w, max_power_w, weight_kg, certifications
  for 23 initial switches (Cisco Nexus/Catalyst, Arista, Juniper, NVIDIA, Edgecore/Celestica/Asterfusion)
- Dashboard: Specifications section now shows Typical Power, Weight, Certifications (colored pills)
This commit is contained in:
Rene Fichtmueller 2026-04-20 22:56:53 +02:00
parent 307a5ea38a
commit 21f5250353
2 changed files with 132 additions and 1 deletions

View File

@ -3900,8 +3900,10 @@ async function openSwitchDetail(id) {
['Layer', s.layer], ['ASIC', (s.asic_vendor || '') + ' ' + (s.asic_model || '')], ['Layer', s.layer], ['ASIC', (s.asic_vendor || '') + ' ' + (s.asic_model || '')],
['Forwarding Rate', s.forwarding_rate_mpps ? s.forwarding_rate_mpps + ' Mpps' : null], ['Forwarding Rate', s.forwarding_rate_mpps ? s.forwarding_rate_mpps + ' Mpps' : null],
['Rack Units', s.rack_units ? s.rack_units + 'U' : null], ['Rack Units', s.rack_units ? s.rack_units + 'U' : null],
['Typical Power', s.typical_power_w ? s.typical_power_w + 'W' : null],
['Max Power', s.max_power_w ? s.max_power_w + 'W' : null], ['Max Power', s.max_power_w ? s.max_power_w + 'W' : null],
['PoE', s.poe_support !== 'None' ? s.poe_support : null], ['Weight', s.weight_kg ? s.weight_kg + ' kg' : null],
['PoE', s.poe_support && s.poe_support !== 'None' ? s.poe_support : null],
['Status', s.lifecycle_status], ['Status', s.lifecycle_status],
]; ];
for (var i = 0; i < specs.length; i++) { for (var i = 0; i < specs.length; i++) {
@ -3909,6 +3911,12 @@ async function openSwitchDetail(id) {
h += '<div class="panel-row"><span class="panel-row-label">' + esc(specs[i][0]) + '</span><span class="panel-row-val">' + esc(specs[i][1]) + '</span></div>'; h += '<div class="panel-row"><span class="panel-row-label">' + esc(specs[i][0]) + '</span><span class="panel-row-val">' + esc(specs[i][1]) + '</span></div>';
} }
} }
// Certifications
if (s.certifications && s.certifications.length > 0) {
h += '<div class="panel-row"><span class="panel-row-label">Certifications</span><span class="panel-row-val" style="display:flex;gap:0.3rem;flex-wrap:wrap">'
+ s.certifications.map(function(c) { return '<span style="background:rgba(99,102,241,0.12);color:#818cf8;font-size:0.65rem;padding:1px 6px;border-radius:8px;font-weight:600">' + esc(c) + '</span>'; }).join('')
+ '</span></div>';
}
h += '<div class="panel-section">Features</div>'; h += '<div class="panel-section">Features</div>';
var features = []; var features = [];

View File

@ -0,0 +1,123 @@
-- TIP: Migration 040 — Switch Physical Facts Seed
-- Populates rack_units, typical_power_w, max_power_w, weight_kg, certifications
-- for the 24 initial seeded switches.
-- ─── Cisco Nexus 9300 / 9500 / 9200 ────────────────────────────────────────
UPDATE switches SET
rack_units = 1, typical_power_w = 340, max_power_w = 400, weight_kg = 16.8,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C9364C';
UPDATE switches SET
rack_units = 1, typical_power_w = 550, max_power_w = 650, weight_kg = 18.2,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C93600CD-GX';
UPDATE switches SET
rack_units = 1, typical_power_w = 410, max_power_w = 500, weight_kg = 16.5,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C9316D-GX';
UPDATE switches SET
rack_units = 1, typical_power_w = 650, max_power_w = 800, weight_kg = 17.2,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C9332D-H2R';
UPDATE switches SET
rack_units = 7, typical_power_w = 850, max_power_w = 1400, weight_kg = 41.0,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C9508';
UPDATE switches SET
rack_units = 1, typical_power_w = 480, max_power_w = 600, weight_kg = 18.0,
certifications = ARRAY['CE','FCC','RoHS','NEBS L3','UL']
WHERE model = 'N9K-C9364D-GX2A';
UPDATE switches SET
rack_units = 1, typical_power_w = 310, max_power_w = 380, weight_kg = 7.9,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = 'N9K-C9232C';
-- ─── Arista 7000 series ─────────────────────────────────────────────────────
UPDATE switches SET
rack_units = 1, typical_power_w = 480, max_power_w = 600, weight_kg = 20.1,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = '7060CX2-32S';
UPDATE switches SET
rack_units = 1, typical_power_w = 510, max_power_w = 640, weight_kg = 21.5,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = '7060DX4-32';
UPDATE switches SET
rack_units = 1, typical_power_w = 720, max_power_w = 900, weight_kg = 22.8,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = '7800R3-36P-LINE';
UPDATE switches SET
rack_units = 1, typical_power_w = 650, max_power_w = 800, weight_kg = 23.0,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = '7060X6-64PE';
UPDATE switches SET
rack_units = 1, typical_power_w = 450, max_power_w = 560, weight_kg = 19.5,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = '7050CX3-32S';
-- ─── Juniper QFX / EX ───────────────────────────────────────────────────────
UPDATE switches SET
rack_units = 1, typical_power_w = 380, max_power_w = 480, weight_kg = 12.7,
certifications = ARRAY['CE','FCC','RoHS','NEBS','UL']
WHERE model = 'QFX5130-32CD';
UPDATE switches SET
rack_units = 1, typical_power_w = 420, max_power_w = 520, weight_kg = 13.5,
certifications = ARRAY['CE','FCC','RoHS','NEBS','UL']
WHERE model = 'QFX5200-32C';
UPDATE switches SET
rack_units = 1, typical_power_w = 280, max_power_w = 350, weight_kg = 10.2,
certifications = ARRAY['CE','FCC','RoHS','NEBS','UL']
WHERE model = 'EX4650-48Y';
-- ─── NVIDIA Spectrum ────────────────────────────────────────────────────────
UPDATE switches SET
rack_units = 1, typical_power_w = 530, max_power_w = 660, weight_kg = 17.3,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = 'SN5600';
UPDATE switches SET
rack_units = 1, typical_power_w = 600, max_power_w = 750, weight_kg = 18.6,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = 'SN4700';
UPDATE switches SET
rack_units = 1, typical_power_w = 290, max_power_w = 360, weight_kg = 14.0,
certifications = ARRAY['CE','FCC','RoHS','UL']
WHERE model = 'SN2010M';
-- ─── Edgecore / Celestica / Asterfusion ─────────────────────────────────────
UPDATE switches SET
rack_units = 1, typical_power_w = 420, max_power_w = 520, weight_kg = 14.8,
certifications = ARRAY['CE','FCC','RoHS']
WHERE model = 'AS7726-32X';
UPDATE switches SET
rack_units = 1, typical_power_w = 500, max_power_w = 620, weight_kg = 15.5,
certifications = ARRAY['CE','FCC','RoHS']
WHERE model = 'AS9516-32D';
UPDATE switches SET
rack_units = 1, typical_power_w = 450, max_power_w = 560, weight_kg = 15.0,
certifications = ARRAY['CE','FCC','RoHS']
WHERE model = 'DCS810';
UPDATE switches SET
rack_units = 1, typical_power_w = 490, max_power_w = 600, weight_kg = 14.9,
certifications = ARRAY['CE','FCC','RoHS']
WHERE model = 'CX308P-48YN';
UPDATE switches SET
rack_units = 1, typical_power_w = 520, max_power_w = 640, weight_kg = 16.2,
certifications = ARRAY['CE','FCC','RoHS']
WHERE model = 'CX564P';