feat(storage): 按容量分布与设备状态重设计存储卡片

This commit is contained in:
2026-11-03 17:09:39 +08:00
parent 74f6bdd7f7
commit 6d79ea1856
5 changed files with 238 additions and 8 deletions
+8 -8
View File
@@ -315,14 +315,14 @@ struct MenuPanelView: View {
ResourceCard(title: "metric.disk", symbol: "internaldrive", color: Color("MetricDisk"), value: snapshot.disk.map { String(format: "%.0f / %.0f GB", Double($0.total - min($0.total, $0.available)) / 1_000_000_000, Double($0.total) / 1_000_000_000) } ?? "--") {
PanelTrendChart(dates: samples.map(\.date), first: samples.map(\.read), second: samples.map(\.write), color: Color("MetricDisk"), secondColor: Color("MetricNetwork"), fixedScale: nil, firstLabel: "disk.read", secondLabel: "disk.write", expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
Text("disk.physicalIO").foregroundStyle(.secondary)
HStack { line("disk.read", MetricFormat.rate(snapshot.diskIO?.read)); line("disk.write", MetricFormat.rate(snapshot.diskIO?.written)) }
HStack { line("disk.remainingLife", MetricFormat.percent(snapshot.diskHealth?.remainingLife)); line("disk.powerOnHours", snapshot.diskHealth?.powerOnHours.map { "\($0) h" } ?? "--") }
Spacer(minLength: 0)
Button("disk.volumes") { showVolumes.toggle() }.popover(isPresented: $showVolumes) {
PanelTrendChart(dates: samples.map(\.date), first: samples.map(\.read), second: samples.map(\.write), color: Color("MetricDisk"), secondColor: Color("MetricNetwork"), fixedScale: nil, firstLabel: "disk.read", secondLabel: "disk.write", expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals, plotHeight: 48)
Text("disk.physicalIO")
.font(.system(size: 9)).foregroundStyle(.secondary)
.frame(maxWidth: .infinity, alignment: .trailing)
StorageDetailsView(disk: snapshot.disk, health: snapshot.diskHealth) {
showVolumes.toggle()
}
.popover(isPresented: $showVolumes) {
VStack(alignment: .leading, spacing: 8) {
Text("disk.homeVolume")
Text("panel.smartScope").foregroundStyle(.secondary)