feat: 更新后端平台模块、Compute引擎、前端组件及构建产物
- 更新 backend 平台 API、platform_store、compute_gateway sync - 更新 compute agent/engine/adapter 及 API - 更新 Docker 部署配置(app/compute) - 新增 frontend/src/utils/ 工具模块 - 新增 scripts/ops_diagnostics.py 运维诊断脚本 - 新增 docs/2026-07-23-development-summary.md 开发总结 - 重构 frontend/dist 构建产物(新 hash) - 更新前端多个视图组件及 API 模块 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
99
frontend/src/utils/status.ts
Normal file
99
frontend/src/utils/status.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
type TagType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
pending: '等待中',
|
||||
syncing: '同步中',
|
||||
queued: '排队中',
|
||||
running: '运行中',
|
||||
completed: '已完成',
|
||||
failed: '失败',
|
||||
stopped: '已停止',
|
||||
cancelled: '已取消',
|
||||
starting: '启动中',
|
||||
loading: '加载中',
|
||||
loaded: '已加载',
|
||||
ready: '已就绪',
|
||||
done: '已完成',
|
||||
error: '异常',
|
||||
success: '成功',
|
||||
not_started: '未启动',
|
||||
valid: '有效',
|
||||
modified: '已修改',
|
||||
invalid: '无效',
|
||||
original: '原始',
|
||||
manual: '手动新增',
|
||||
active: '启用',
|
||||
disabled: '停用',
|
||||
online: '在线',
|
||||
offline: '离线',
|
||||
draining: '维护中',
|
||||
maintenance: '维护模式',
|
||||
busy: '忙碌',
|
||||
reserved: '已预留',
|
||||
idle: '空闲',
|
||||
warning: '告警',
|
||||
available: '可用',
|
||||
missing: '缺失',
|
||||
synced: '已同步',
|
||||
drifted: '已漂移',
|
||||
repair_pending: '待修复',
|
||||
}
|
||||
|
||||
const STATUS_TYPES: Record<string, TagType> = {
|
||||
completed: 'success',
|
||||
success: 'success',
|
||||
running: 'success',
|
||||
ready: 'success',
|
||||
loaded: 'success',
|
||||
active: 'success',
|
||||
online: 'success',
|
||||
busy: 'success',
|
||||
available: 'success',
|
||||
synced: 'success',
|
||||
valid: 'success',
|
||||
pending: 'info',
|
||||
idle: 'info',
|
||||
offline: 'info',
|
||||
disabled: 'info',
|
||||
original: 'info',
|
||||
stopped: 'info',
|
||||
cancelled: 'info',
|
||||
syncing: 'warning',
|
||||
queued: 'warning',
|
||||
starting: 'warning',
|
||||
loading: 'warning',
|
||||
reserved: 'warning',
|
||||
warning: 'warning',
|
||||
modified: 'warning',
|
||||
draining: 'warning',
|
||||
maintenance: 'warning',
|
||||
repair_pending: 'warning',
|
||||
failed: 'danger',
|
||||
error: 'danger',
|
||||
invalid: 'danger',
|
||||
missing: 'danger',
|
||||
drifted: 'danger',
|
||||
}
|
||||
|
||||
export function statusLabel(status?: string | number | null) {
|
||||
const key = String(status ?? '').trim()
|
||||
if (!key) return '未知'
|
||||
return STATUS_LABELS[key] || key
|
||||
}
|
||||
|
||||
export function statusTagType(status?: string | number | null): TagType {
|
||||
const key = String(status ?? '').trim()
|
||||
return STATUS_TYPES[key] || 'info'
|
||||
}
|
||||
|
||||
export function mergeStatusLabel(row: { merged?: boolean; merging?: boolean }) {
|
||||
if (row.merging) return '合并中'
|
||||
if (row.merged) return '已合并'
|
||||
return '未合并'
|
||||
}
|
||||
|
||||
export function mergeStatusType(row: { merged?: boolean; merging?: boolean }): TagType {
|
||||
if (row.merging) return 'warning'
|
||||
if (row.merged) return 'success'
|
||||
return 'info'
|
||||
}
|
||||
Reference in New Issue
Block a user