Show connected clients and their last human action in Status
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user