feat(panel): 调整资源卡片读数布局并保留趋势平移

逐核显示 CPU 占用,在 GPU 标题展示核数并补充分项读数。无电池设备显示整机功率。

存储与网络将曲线排在详情下方,CPU、GPU、内存和电池保留整卡趋势。数值直接刷新,曲线随采样平滑平移。顶栏展示版本号,底栏调整开机时间和刷新间隔。
This commit is contained in:
2026-11-15 22:03:46 +08:00
parent c886c4227d
commit 6300db3d15
27 changed files with 427 additions and 250 deletions
+3 -3
View File
@@ -46,11 +46,11 @@ import CoreGraphics
precondition(PanelLayout.columns(width: 648) == 3 && PanelLayout.columns(width: 620) == 3)
precondition(PanelLayout.columns(width: 619) == 2 && PanelLayout.columns(width: 430) == 2 && PanelLayout.columns(width: 429) == 1)
let tallerCPU = PanelLayout.cardHeights(coreRows: 6, fanCount: 2)
precondition(PanelLayout.rowHeights(columns: 3, heights: tallerCPU) == [346, 346],
precondition(PanelLayout.rowHeights(columns: 3, heights: tallerCPU) == [251, 251],
"All resource rows must share the maximum structural card height")
let moreFans = PanelLayout.cardHeights(coreRows: 1, fanCount: 10)
precondition(moreFans[.gpu]! > compact[.gpu]! && moreFans[.storage] == compact[.storage])
precondition(PanelLayout.rowHeights(columns: 3, heights: moreFans) == [232, 232])
precondition(PanelLayout.rowHeights(columns: 3, heights: moreFans) == [248, 248])
let noFans = PanelLayout.cardHeights(coreRows: 1, fanCount: 0)
precondition(noFans[.gpu] == 176 && PanelLayout.rowHeights(columns: 3, heights: noFans) == [176, 176])
precondition(PanelLayout.preferredHeight(width: 648, heights: noFans) == 630,
@@ -64,7 +64,7 @@ import CoreGraphics
precondition(requested.height == 732, "A hardware-driven height above the default must be preserved")
precondition(PanelLayout.processHeight(heights: compact) == 176)
precondition(PanelLayout.dashboardHeight(columns: 3, heights: compact) == 540)
precondition(PanelLayout.processHeight(heights: tallerCPU) == 346)
precondition(PanelLayout.processHeight(heights: tallerCPU) == 251)
let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)
let path: String? = index == 42 ? "/test/needle" : nil