macos: show detailed health failure
This commit is contained in:
@@ -330,14 +330,34 @@ private enum RemoteStatus: Equatable {
|
|||||||
|
|
||||||
extension GeneralSettings {
|
extension GeneralSettings {
|
||||||
private var healthRow: some View {
|
private var healthRow: some View {
|
||||||
HStack(spacing: 10) {
|
VStack(alignment: .leading, spacing: 6) {
|
||||||
Circle()
|
HStack(spacing: 10) {
|
||||||
.fill(self.healthStore.state.tint)
|
Circle()
|
||||||
.frame(width: 10, height: 10)
|
.fill(self.healthStore.state.tint)
|
||||||
Text(self.healthStore.summaryLine)
|
.frame(width: 10, height: 10)
|
||||||
.font(.callout)
|
Text(self.healthStore.summaryLine)
|
||||||
.lineLimit(1)
|
.font(.callout)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let detail = self.healthStore.detailLine {
|
||||||
|
Text(detail)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack(spacing: 10) {
|
||||||
|
Button("Retry now") {
|
||||||
|
Task { await HealthStore.shared.refresh(onDemand: true) }
|
||||||
|
}
|
||||||
|
.disabled(self.healthStore.isRefreshing)
|
||||||
|
|
||||||
|
Button("Open logs") { self.revealLogs() }
|
||||||
|
.buttonStyle(.link)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
.font(.caption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,21 @@ final class HealthStore: ObservableObject {
|
|||||||
return "linked · auth \(auth) · socket ok"
|
return "linked · auth \(auth) · socket ok"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Short, human-friendly detail for the last failure, used in the UI.
|
||||||
|
var detailLine: String? {
|
||||||
|
if let error = self.lastError, !error.isEmpty {
|
||||||
|
let lower = error.lowercased()
|
||||||
|
if lower.contains("connection refused") {
|
||||||
|
return "The relay control port (127.0.0.1:18789) isn’t listening — restart Clawdis to bring it back."
|
||||||
|
}
|
||||||
|
if lower.contains("timeout") {
|
||||||
|
return "Timed out waiting for the control server; the relay may be crashed or still starting."
|
||||||
|
}
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
private func describeFailure(from snap: HealthSnapshot, fallback: String?) -> String {
|
private func describeFailure(from snap: HealthSnapshot, fallback: String?) -> String {
|
||||||
if !snap.web.linked {
|
if !snap.web.linked {
|
||||||
return "Not linked — run clawdis login"
|
return "Not linked — run clawdis login"
|
||||||
|
|||||||
Reference in New Issue
Block a user