Issue #5: Check server status on start.
This commit is contained in:
parent
603a23a1a8
commit
f7ac3d9aed
3 changed files with 90 additions and 38 deletions
58
dns/SummaryStatus.swift
Normal file
58
dns/SummaryStatus.swift
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
//
|
||||
// SummaryStatus.swift
|
||||
// dns
|
||||
//
|
||||
// Created by Benjamin Erhart on 15.04.26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct Status: Codable {
|
||||
|
||||
let summaryStatus: SummaryStatus
|
||||
}
|
||||
|
||||
enum SummaryStatus: String, Codable, CustomStringConvertible {
|
||||
|
||||
case pending
|
||||
case ok
|
||||
case notice
|
||||
case disrupted
|
||||
case down
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .pending:
|
||||
return "Fetching service status"
|
||||
|
||||
case .ok:
|
||||
return "No issues detected"
|
||||
|
||||
case .notice:
|
||||
return "In maintenance"
|
||||
|
||||
case .disrupted:
|
||||
return "Service disruption"
|
||||
|
||||
case .down:
|
||||
return "Service down"
|
||||
}
|
||||
}
|
||||
|
||||
var color: Color {
|
||||
switch self {
|
||||
case .pending:
|
||||
return .gray
|
||||
|
||||
case .ok:
|
||||
return .green
|
||||
|
||||
case .notice, .disrupted:
|
||||
return .orange
|
||||
|
||||
case .down:
|
||||
return .red
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue