import { memo } from 'react'; import { formatUtc, getStatusClass } from '../../utils/appUiHelpers'; function AppStatusHeader({ language, setLanguage, currentUser, isAdmin, isReadOnlyUser, activeTasks, avgTaskProgress, licenseStatus, healthStatus, healthLoading, healthError, onRefreshHealth, onLogout, }) { const hasHealthStatus = !!healthStatus; const licenseOk = !!licenseStatus?.ok; const dbOk = !!(healthStatus?.database?.ok && healthStatus?.database?.schema_ok && healthStatus?.database?.postgis_ok); const workerOk = !!healthStatus?.worker?.ok; const idlOk = !!healthStatus?.idl?.ok; const aiOk = !!healthStatus?.ollama?.ok; const nginxOk = !!healthStatus?.nginx?.ok; return ( <>
InSAR 自动化管理系统
科研工程模式 · {licenseOk ? '已授权' : '未授权'}
DB
Worker
IDL
Ollama
Nginx
{currentUser.username} · {isAdmin ? '管理员' : '只读账号'}
0 ? 'has-active-tasks' : ''}`}> {activeTasks.length > 0 ? `⚙️ 运行中 ${activeTasks.length}` : '✓ 空闲'} {activeTasks.length > 0 && (
)}
{licenseStatus?.expires_at && (
授权至 {formatUtc(licenseStatus.expires_at, language)}
)}
{isReadOnlyUser && (
当前账号为只读权限:可查看数据与状态,但不能执行写操作。
)} ); } export default memo(AppStatusHeader);