Show connected clients and their last human action in Status

This commit is contained in:
Ian Gulliver
2026-10-17 23:24:26 -07:00
parent 28c4549151
commit 8d9ba10849
8 changed files with 332 additions and 246 deletions
+33 -1
View File
@@ -4,7 +4,7 @@ import SwiftUI
typealias AgentProcess = Components.Schemas.AgentProcess
typealias Zombie = Components.Schemas.Zombie
private let refreshKinds: Set<String> = ["session.created", "session.state", "task.created", "task.merged", "task.discarded", "project.created", "admin.health"]
private let refreshKinds: Set<String> = ["session.created", "session.state", "task.created", "task.merged", "task.discarded", "project.created", "admin.health", "admin.clients"]
private let zombieLabel: [Zombie.KindPayload: String] = [
.runningWithoutProcess: "Running with no process",
@@ -88,6 +88,8 @@ struct StatusView: View {
if vendors.isEmpty {
Text("No vendor has reported a rate-limit status since byre started.").foregroundStyle(Palette.muted)
}
section("Clients")
ClientTable(status: status)
section("Server")
ServerRows(status: status)
}
@@ -377,6 +379,36 @@ private struct PaceBar: View {
}
}
private struct ClientTable: View {
let status: ServerStatus
var body: some View {
if status.clients.isEmpty {
Text("No clients connected.").foregroundStyle(Palette.muted)
} else {
Grid(alignment: .leading, horizontalSpacing: 12, verticalSpacing: 2) {
GridRow {
ForEach(["Mac", "User", "Build", "Connected", "Last action"], id: \.self) { h in
Text(h).font(Fonts.font(11)).foregroundStyle(Palette.muted)
}
}
Divider().overlay(Palette.border)
ForEach(Array(status.clients.enumerated()), id: \.offset) { _, c in
GridRow {
Text(c.host.isEmpty ? "—" : c.host)
Text(c.login)
Text(c.commit.isEmpty ? "—" : String(c.commit.prefix(8))).help(c.commit)
Text(since(c.connectedAt))
Text(c.lastActionAt.map(since) ?? "—")
}
.textSelection(.enabled)
Divider().overlay(Palette.border)
}
}
}
}
}
private struct ServerRows: View {
let status: ServerStatus