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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user