37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
struct StorageDetailsView: View {
|
|
let disk: DiskMetrics?
|
|
let health: DiskHealthMetrics?
|
|
let showVolumes: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
CardSeparator()
|
|
HStack(alignment: .top, spacing: 8) {
|
|
CardField(title: "memory.available") {
|
|
MetricText(value: MetricFormat.bytes(disk?.available))
|
|
}
|
|
Divider().frame(height: 32)
|
|
CardField(title: "disk.remainingLife") {
|
|
MetricText(value: MetricFormat.percent(health?.remainingLife))
|
|
}
|
|
Divider().frame(height: 32)
|
|
CardField(title: "disk.powerOnHours") {
|
|
MetricText(value: health?.powerOnHours.map { "\($0) h" } ?? "--")
|
|
}
|
|
Divider().frame(height: 32)
|
|
CardField(title: "disk.localVolumes") {
|
|
Button(action: showVolumes) {
|
|
HStack(spacing: 2) {
|
|
Text("disk.viewDetails")
|
|
Image(systemName: "chevron.right").font(.system(size: 8))
|
|
}
|
|
}.buttonStyle(.plain)
|
|
}
|
|
}.font(PanelStyle.label).lineLimit(1)
|
|
}
|
|
}
|
|
|
|
}
|