18 lines
647 B
TypeScript
18 lines
647 B
TypeScript
import type { AliveStatus } from '@/types/api'
|
|
|
|
/** 测活状态 → 展示标签与徽标语义;suspended 来自云端账户能力接口的暂停标记 */
|
|
export const aliveStatusMeta: Record<
|
|
AliveStatus,
|
|
{ label: string; kind: 'run' | 'term' | 'warn' | 'check' }
|
|
> = {
|
|
alive: { label: '存活', kind: 'run' },
|
|
dead: { label: '失联', kind: 'term' },
|
|
suspended: { label: '暂停', kind: 'warn' },
|
|
unknown: { label: '未测', kind: 'check' },
|
|
}
|
|
|
|
/** 兜底取值:后端新增状态时前端旧包不至于崩 */
|
|
export function aliveMeta(status: string) {
|
|
return aliveStatusMeta[status as AliveStatus] ?? aliveStatusMeta.unknown
|
|
}
|