refactor: dedupe status-severity ranking and small webui helpers

statusSeverity was byte-for-byte duplicated in collector/contract.go and
app/sat_overlay.go (same switch, same comment). Export it as
collector.StatusSeverity and drop the app-package copy.

page_topo.go inlined the same GPU/NIC/RAID class switch as its own
pcieDeviceKind function in one spot — call the function instead.

page_validate.go had its own copy of pages.go's firstNonEmpty (all call
sites already pre-trim their inputs via validateTrimPtr, so the extra
TrimSpace was redundant) — drop the duplicate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-08-18 14:44:52 +03:00
co-authored by Claude Sonnet 5
parent e3697c0a11
commit 134bed3eae
4 changed files with 14 additions and 46 deletions
+2 -9
View File
@@ -614,15 +614,8 @@ func renderTopoMainDiagram(hw schema.HardwareSnapshot, exportDir string) string
}
var placed []placedDevice
for _, dev := range hw.PCIeDevices {
var kind string
switch {
case dev.DeviceClass != nil && isGPUDeviceClass(*dev.DeviceClass):
kind = "gpu"
case isNICDeviceClassDev(dev):
kind = "nic"
case dev.DeviceClass != nil && isRAIDControllerClass(*dev.DeviceClass):
kind = "raid"
default:
kind := pcieDeviceKind(dev)
if kind == "" {
continue
}
col := unknownCol