feat(admin): show Probe status and retry links

This commit is contained in:
justme committed 2026-10-10 14:17:19 +08:00
1 parent 97ab3cc740
commit efb50d0efe
7 files changed
+172 -21

No files matched your search

+19 -1
View File
@@ -1,8 +1,9 @@
import { useEffect, useMemo, useState } from 'react'
import { api } from './api/client'
import type { NodeInfoDto, Page } from './api/types'
import type { NodeInfoDto, NodeRuntimeStatus, Page } from './api/types'
import { useQuery } from './hooks'
import { OsIcon } from './osIcon'
import { Chip } from './ui'
import mobileIcon from './assets/isp/mobile.svg?url'
import telecomIcon from './assets/isp/telecom.svg?url'
import unicomIcon from './assets/isp/unicom.svg?url'
@@ -102,3 +103,20 @@ export function NodeTag({ info, geoOnly }: TagProps) {
</span>
)
}
const RUNTIME_STATUS: Record<NodeRuntimeStatus, { label: string; tone: 'ok' | 'warn' | 'bad' | 'accent' | '' }> = {
initializing: { label: '初始化中', tone: 'warn' },
running: { label: '运行中', tone: 'ok' },
probe_paused: { label: '暂停探测', tone: 'warn' },
maintenance: { label: '维护中', tone: 'warn' },
stopping: { label: '停止中', tone: 'warn' },
offline: { label: '失联', tone: 'bad' },
updating: { label: '更新中', tone: 'accent' },
}
export function RuntimeStatusChip({ status }: { status: NodeRuntimeStatus }) {
const value = RUNTIME_STATUS[status] ?? { label: status, tone: '' as const }
return <Chip tone={value.tone}>{value.label}</Chip>
}
export const runtimeStatusLabel = (status: NodeRuntimeStatus) => RUNTIME_STATUS[status]?.label ?? status