feat(dashboard): add v2 client detail status (#5381)

This commit is contained in:
fatedier
2026-06-26 21:15:30 +08:00
committed by GitHub
parent 393a533744
commit ae1c0504ec
8 changed files with 320 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
import { formatDistanceToNow } from './format'
import type { ClientInfoData } from '../types/client'
import type { ClientInfoData, ClientStatus } from '../types/client'
export class Client {
key: string
@@ -15,6 +15,7 @@ export class Client {
lastConnectedAt: Date
disconnectedAt?: Date
online: boolean
status: ClientStatus
constructor(data: ClientInfoData) {
this.key = data.key
@@ -37,6 +38,11 @@ export class Client {
this.disconnectedAt = new Date(data.disconnectedAt * 1000)
}
this.online = data.online
this.status = data.status || {
phase: this.online ? 'online' : 'offline',
curConns: 0,
proxyCount: 0,
}
}
get displayName(): string {