1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

🏗 WIP: Services manager main status

Please note that these are computed properties.
They should be computed when a service status
is modified, and should be `Published`.
This commit is contained in:
2022-12-24 15:04:25 +01:00
parent de2c1aca5d
commit 59f60b5013
2 changed files with 32 additions and 2 deletions

View File

@@ -21,6 +21,36 @@ class ServicesManager: ObservableObject {
}
}
public var statusMessage: String {
let statuses = self.services[0...2].map { $0.status }
if statuses.contains(.loading) {
return "Determining Valet status..."
}
if statuses.contains(.missing) {
return "A key service is not installed."
}
if statuses.contains(.inactive) {
return "A key service is not running."
}
return "All Valet services are OK."
}
public var statusColor: Color {
let statuses = self.services[0...2].map { $0.status }
if statuses.contains(.loading) {
return .orange
}
if statuses.contains(.missing) {
return .red
}
if statuses.contains(.inactive) {
return .red
}
return .green
}
@available(*, deprecated, message: "Use a more specific method instead")
static func loadHomebrewServices() {
print(self.shared)