initial commit

This commit is contained in:
Jon Vanvik 2026-05-31 14:11:29 +02:00
commit 8de962eeb8
44 changed files with 4843 additions and 0 deletions

View file

@ -0,0 +1,70 @@
import SwiftUI
/// ONUs flagged with an abnormal Rx optical level drilled into from the
/// dashboard Health section. Uses the docs the dashboard already scanned.
struct AbnormalRxListView: View {
let connection: MCMSConnection
let onus: [ONUStateDoc]
var body: some View {
List(onus) { onu in
NavigationLink {
ONUDetailView(connection: connection, onuId: onu.id)
} label: {
HStack {
VStack(alignment: .leading, spacing: 2) {
Text(onu.displayName).font(.body.weight(.medium))
if let olt = onu.parentOLT {
Text("OLT \(olt)").font(.caption).foregroundStyle(.secondary)
}
}
Spacer()
if let rx = onu.rxOpticalDBm {
VStack(alignment: .trailing, spacing: 2) {
Text("\(rx.formatted(.number.precision(.fractionLength(1)))) dBm")
.font(.callout.monospacedDigit()).foregroundStyle(.orange)
Text(rx < -28 ? "weak" : "strong")
.font(.caption2).foregroundStyle(.secondary)
}
}
}
}
}
.listStyle(.plain)
.navigationTitle("Abnormal Rx")
.navigationBarTitleDisplayMode(.inline)
.overlay {
if onus.isEmpty {
ContentUnavailableView("All Rx levels normal", systemImage: "checkmark.circle")
}
}
}
}
/// OLTs whose laser is shut down drilled into from the dashboard Health section.
struct LaserOffListView: View {
let connection: MCMSConnection
let olts: [OLTStateDoc]
var body: some View {
List(olts) { olt in
NavigationLink {
OLTDetailView(connection: connection, oltId: olt.id, title: olt.displayName)
} label: {
VStack(alignment: .leading, spacing: 2) {
Text(olt.displayName).font(.body.weight(.medium))
Text(olt.laserShutdown ?? "Laser off")
.font(.caption).foregroundStyle(.orange)
}
}
}
.listStyle(.plain)
.navigationTitle("Laser off")
.navigationBarTitleDisplayMode(.inline)
.overlay {
if olts.isEmpty {
ContentUnavailableView("All lasers on", systemImage: "checkmark.circle")
}
}
}
}