Repository Public
1import MCCCore2import SwiftUI34/// Root screen of each section.5struct SectionRoot: View {6 let section: AppSection7 var body: some View {8 switch section {9 case .overview: OverviewScreen()10 case .nodes: NodesScreen()11 case .alerts: AlertsScreen()12 case .actions: ActionsScreen()13 case .services: ServicesScreen()14 case .models: ModelsScreen()15 case .jobs: JobsScreen()16 case .maintenance: MaintenanceScreen()17 case .network: NetworkScreen()18 case .storage: StorageScreen()19 case .activity: ActivityScreen()20 case .audit: AuditScreen()21 case .settings: SettingsScreen()22 }23 }24}2526/// Screen of a pushed destination.27struct RouteView: View {28 let route: Route29 var body: some View {30 switch route {31 case .section(let s): SectionRoot(section: s)32 case .node(let id): NodeDetailScreen(nodeID: id)33 case .compare(let ids): NodeCompareScreen(nodeIDs: ids)34 case .alert(let id): AlertDetailScreen(alertID: id)35 case .incident(let id): IncidentDetailScreen(incidentID: id)36 case .silences: SilencesScreen()37 case .action(let id): ActionRunScreen(actionID: id)38 case .actionCatalog: ActionCatalogScreen()39 case .approvals: ApprovalsScreen()40 case .service(let id): ServiceDetailScreen(serviceID: id)41 case .serviceLogs(let id, let name): ServiceLogsScreen(serviceID: id, serviceName: name)42 case .model(let id): ModelDetailScreen(serverID: id)43 case .job(let id): JobDetailScreen(jobID: id)44 case .maintenanceWindow(let id, let occurrence): MaintenanceWindowScreen(windowID: id, occurrence: occurrence)45 case .nodeNotes(let id): NodeNotesScreen(nodeID: id)46 case .settings(let pane): SettingsPaneScreen(pane: pane)47 }48 }49}5051/// Content of a sheet. Sheets get their own navigation stack and the scene's environment.52struct SheetHost: View {53 let route: SheetRoute54 var body: some View {55 NavigationStack {56 switch route {57 case .actionRequest(let type, let target, let label, let preset):58 ActionRequestSheet(typeName: type, target: target, targetLabel: label, preset: preset)59 case .actionPicker(let target, let label):60 ActionPickerSheet(target: target, targetLabel: label)61 case .windowEditor(let id, let day, let nodeID):62 MaintenanceWindowEditor(windowID: id, day: day, nodeID: nodeID)63 case .noteEditor(let context):64 NoteEditorSheet(context: context)65 case .search:66 SearchSheet()67 }68 }69 .mccThemed()70 }71}72