Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Adapters from './pages/Adapters'
import Instances from './pages/Instances'
import Messages from './pages/Messages'
import RoutesPage from './pages/Routes'
import Monitoring from './pages/Monitoring'
import Ops from './pages/Ops'
import Settings from './pages/Settings'
import Login from './pages/Login'
import Register from './pages/Register'
Expand Down Expand Up @@ -43,7 +43,12 @@ function App() {
<Route path="messages" element={<Messages />} />
<Route path="adapter-gateway" element={<AdapterGateway />} />
<Route path="routes" element={<RoutesPage />} />
<Route path="monitoring" element={<Monitoring />} />
<Route path="ops" element={<Ops />} />
{/* Legacy path. The app is a `BrowserRouter` SPA served by a
fallback proxy, so this `<Navigate replace>` *is* the redirect —
there is no server-side 301 to add. The catch-all-free route
structure is unchanged. */}
<Route path="monitoring" element={<Navigate to="/ops" replace />} />
<Route path="settings" element={<Settings />} />
<Route path="docs" element={<Docs />} />
<Route path="docs/:key" element={<DocViewer />} />
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const NAV_ITEMS: NavItem[] = [
{ path: '/instances', icon: Server, labelKey: 'nav.instances', group: 'business' },
{ path: '/messages', icon: MessageSquare, labelKey: 'nav.messages', group: 'business' },
{ path: '/routes', icon: GitBranch, labelKey: 'nav.routes', group: 'business' },
{ path: '/monitoring', icon: Monitor, labelKey: 'nav.monitoring', group: 'ops' },
// The `ops` group holds exactly this one entry; the dashboard rail's ops
// summary folded into it, so there is no second ops destination.
{ path: '/ops', icon: Monitor, labelKey: 'nav.ops', group: 'ops' },
{ path: '/settings', icon: SettingsIcon, labelKey: 'nav.settings', group: 'settings' },
{ path: '/docs', icon: BookOpen, labelKey: 'nav.docs', group: 'settings' },
]
Expand Down
40 changes: 19 additions & 21 deletions web/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"routes": "Routes",
"docs": "Documentation",
"settings": "Settings",
"monitoring": "Monitoring",
"primary": "Primary navigation",
"breadcrumb": "Breadcrumb",
"openMenu": "Open navigation",
"collapse": "Collapse sidebar",
"expand": "Expand sidebar",
"group": {
"business": "Business",
"ops": "Operations",
"ops": "Ops",
"settings": "Settings"
}
},
"ops": "Operations"
},
"common": {
"loading": "Loading...",
Expand Down Expand Up @@ -72,13 +72,11 @@
"title": "Dashboard",
"overview": "System Overview",
"totalPlatforms": "Total Platforms",
"totalAdapters": "Total Adapters",
"totalInstances": "Total Instances",
"totalMessages": "Total Messages",
"recentActivity": "Recent Activity",
"noActivity": "No activity yet",
"newMessage": "New message",
"systemStatus": "System Status",
"statusOnline": "Online",
"statusOffline": "Offline",
"statusChecking": "Checking",
Expand All @@ -87,17 +85,13 @@
"noInstances": "No instances",
"subtitle": "Key metrics and recent activity at a glance",
"recentActivityHint": "Latest adapter and message events",
"systemStatusHint": "Backend reachability and runtime summary",
"backendStatus": "Backend service",
"backendChecking": "Checking",
"backendOnline": "Online",
"backendOffline": "Offline",
"quickActions": "Quick actions",
"adapterCreated": "Adapter created",
"messageReceived": "Message received",
"noRecentActivity": "No recent activity",
"noRecentActivityHint": "Create an adapter or receive a message and it will show up here.",
"refreshed": "Data refreshed."
"refreshed": "Data refreshed.",
"backendOffline": "Offline"
},
"connection": {
"lostTitle": "Connection to backend lost",
Expand Down Expand Up @@ -351,28 +345,32 @@
"targetTypeRequired": "Target type is required.",
"targetIdRequired": "Target ID is required."
},
"monitoring": {
"title": "Monitoring",
"ops": {
"title": "Operations",
"description": "Auto-refreshes every 5s; manual refresh available.",
"metricsHeading": "Runtime overview",
"backendConnectivity": "Backend connectivity",
"backendChecking": "Checking",
"backendOnline": "Online",
"backendOffline": "Offline",
"totalAdapters": "Total Instances",
"runningAdapters": "Running",
"errorAdapters": "Errored",
"stoppedAdapters": "Stopped",
"totalMessages": "Messages",
"avgResponseTime": "Avg Response",
"adapterStatus": "Instance Status",
"adapterStatusHint": "Connection and throughput per instance",
"noAdapters": "Nothing to monitor",
"noAdaptersHint": "Create an instance under Instance Management first.",
"messages": "Messages",
"errors": "Errors",
"lastHeartbeat": "Last heartbeat",
"realtimeMetrics": "Real-time Metrics",
"messagesPerMinute": "Messages / min",
"errorRate": "Error rate",
"uptime": "Uptime",
"subtitle": "Instance heartbeats, connection state and live metrics",
"description": "Refreshes every 5 seconds; you can also refresh manually.",
"stoppedAdapters": "Stopped",
"errorAdapters": "Errored",
"adapterStatusHint": "Connection and throughput per instance",
"noAdaptersHint": "Create an instance under Instance Management first.",
"updatedAt": "Updated at {{time}}"
"updatedAt": "Updated at {{time}}",
"subtitle": "Backend connectivity, instance heartbeats and live metrics"
},
"settings": {
"title": "Settings",
Expand Down
38 changes: 18 additions & 20 deletions web/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"routes": "路由规则",
"docs": "文档中心",
"settings": "设置",
"monitoring": "运行监控",
"primary": "主导航",
"breadcrumb": "位置",
"openMenu": "打开导航",
Expand All @@ -25,7 +24,8 @@
"business": "业务",
"ops": "运维",
"settings": "设置"
}
},
"ops": "运维面板"
},
"common": {
"loading": "加载中...",
Expand Down Expand Up @@ -72,13 +72,11 @@
"title": "仪表盘",
"overview": "系统概览",
"totalPlatforms": "平台总数",
"totalAdapters": "接入器总数",
"totalInstances": "实例总数",
"totalMessages": "消息总数",
"recentActivity": "最近活动",
"noActivity": "暂无活动记录",
"newMessage": "收到新消息",
"systemStatus": "系统状态",
"statusOnline": "在线",
"statusOffline": "离线",
"statusChecking": "检查中",
Expand All @@ -87,17 +85,13 @@
"noInstances": "暂无实例",
"subtitle": "关键指标与最近活动一览",
"recentActivityHint": "接入器与消息的最新动态",
"systemStatusHint": "后端连通性与运行摘要",
"backendStatus": "后端服务",
"backendChecking": "检测中",
"backendOnline": "在线",
"backendOffline": "离线",
"quickActions": "快捷操作",
"adapterCreated": "接入器已创建",
"messageReceived": "收到新消息",
"noRecentActivity": "暂无最近活动",
"noRecentActivityHint": "创建接入器或收到消息后会出现在这里。",
"refreshed": "数据已刷新。"
"refreshed": "数据已刷新。",
"backendOffline": "离线"
},
"connection": {
"lostTitle": "与后端连接已断开",
Expand Down Expand Up @@ -351,28 +345,32 @@
"targetTypeRequired": "请选择目标类型。",
"targetIdRequired": "请填写目标 ID。"
},
"monitoring": {
"title": "运行监控",
"ops": {
"title": "运维面板",
"description": "每 5 秒自动刷新,也可手动刷新。",
"metricsHeading": "运行概览",
"backendConnectivity": "后端连通性",
"backendChecking": "检测中",
"backendOnline": "在线",
"backendOffline": "离线",
"totalAdapters": "实例总数",
"runningAdapters": "运行中",
"errorAdapters": "异常",
"stoppedAdapters": "已停止",
"totalMessages": "累计消息",
"avgResponseTime": "平均响应",
"adapterStatus": "实例状态",
"adapterStatusHint": "按实例展示连接与吞吐",
"noAdapters": "没有可监控的实例",
"noAdaptersHint": "先在实例管理中创建实例。",
"messages": "消息",
"errors": "错误",
"lastHeartbeat": "最后心跳",
"realtimeMetrics": "实时指标",
"messagesPerMinute": "每分钟消息",
"errorRate": "错误率",
"uptime": "可用率",
"subtitle": "实例心跳、连接状态与实时指标",
"description": "每 5 秒自动刷新,也可手动刷新。",
"stoppedAdapters": "已停止",
"errorAdapters": "异常",
"adapterStatusHint": "按实例展示连接与吞吐",
"noAdaptersHint": "先在实例管理中创建实例。",
"updatedAt": "更新于 {{time}}"
"updatedAt": "更新于 {{time}}",
"subtitle": "后端连通性、实例心跳与实时指标"
},
"settings": {
"title": "设置",
Expand Down
83 changes: 10 additions & 73 deletions web/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Card, CardBody, CardFooter, CardHeader, CardTitle } from '../components
import { Badge } from '../components/ui/badge'
import { Button } from '../components/ui/button'
import { EmptyState } from '../components/ui/empty-state'
import { Skeleton, SkeletonText } from '../components/ui/skeleton'
import { SkeletonText } from '../components/ui/skeleton'

interface RecentActivity {
id: string
Expand All @@ -27,18 +27,14 @@ interface RecentActivity {
timestamp: string
}

type BackendStatus = 'checking' | 'online' | 'offline'

const activityDot: Record<RecentActivity['type'], string> = {
adapter: 'bg-success',
const activityDot: Record<RecentActivity['type'], string> = { adapter: 'bg-success',
message: 'bg-info',
route: 'bg-text-tertiary',
}

export default function Dashboard() {
const { t } = useTranslation()
const [loading, setLoading] = useState(true)
const [backendStatus, setBackendStatus] = useState<BackendStatus>('checking')
const [counts, setCounts] = useState({ platforms: 0, adapters: 0, instances: 0, messages: 0 })
const [recentActivities, setRecentActivities] = useState<RecentActivity[]>([])
const [error, setError] = useState<string | null>(null)
Expand All @@ -54,11 +50,6 @@ export default function Dashboard() {
useEffect(() => {
let cancelled = false

apiClient.healthCheck().then((health) => {
if (cancelled) return
setBackendStatus(health.status === 'ok' ? 'online' : 'offline')
})

Promise.all([
apiClient.getPlatforms(),
apiClient.getAdapters(),
Expand Down Expand Up @@ -117,13 +108,6 @@ export default function Dashboard() {
{ label: t('dashboard.totalMessages'), value: counts.messages, icon: MessageSquare, tone: 'neutral' as const, to: '/messages' },
]

const backendBadge =
backendStatus === 'online'
? { variant: 'success' as const, label: t('dashboard.backendOnline') }
: backendStatus === 'offline'
? { variant: 'danger' as const, label: t('dashboard.backendOffline') }
: { variant: 'neutral' as const, label: t('dashboard.backendChecking') }

return (
<>
<PageHeader
Expand Down Expand Up @@ -186,7 +170,7 @@ export default function Dashboard() {
</h2>
{/* `lg:` is repeated on purpose: `StatGrid` hard-codes `lg:grid-cols-4`
and a fourth metric no longer exists. */}
<StatGrid className="grid-cols-1 md:grid-cols-[repeat(3,minmax(0,1fr))] lg:grid-cols-[repeat(3,minmax(0,1fr))]">
<StatGrid className="gap-6 grid-cols-1 md:grid-cols-[repeat(3,minmax(0,1fr))] lg:grid-cols-[repeat(3,minmax(0,1fr))]">
{stats.map((stat) => (
<Link
key={stat.to}
Expand All @@ -206,7 +190,7 @@ export default function Dashboard() {
</StatGrid>
</section>

<div className="grid min-w-0 grid-cols-1 items-start gap-4 md:grid-cols-3">
<div className="grid min-w-0 grid-cols-1 items-start gap-6 md:grid-cols-3">
{/* Activity — the widest, densest block. */}
<Card padding="none" className="min-w-0 md:col-span-2">
{/* One column while the card is phone-narrow, then two shrinkable
Expand All @@ -218,10 +202,10 @@ export default function Dashboard() {
<p className="mt-1 min-w-0 break-words text-xs text-text-tertiary">{t('dashboard.recentActivityHint')}</p>
</div>
<Link
to="/monitoring"
to="/ops"
className="min-w-0 break-words text-xs font-medium text-primary hover:underline sm:justify-self-end sm:text-end"
>
{t('nav.monitoring')}
{t('nav.ops')}
</Link>
</CardHeader>
{loading ? (
Expand Down Expand Up @@ -257,58 +241,11 @@ export default function Dashboard() {
)}
</Card>

{/* Right rail — lower density, secondary information. `min-w-0` on the
rail and wrapping labels let the status rows give way instead of
pushing a badge out of the card when the column is narrow. */}
{/* Right rail — lower density, secondary information. The ops summary
(backend reachability + adapter/message totals) moved to `/ops`;
all that remains here is quick actions, whose header link above is
the compact way into that page. */}
<div className="stack min-w-0">
<Card padding="none" className="min-w-0">
<CardHeader>
<div className="min-w-0">
<CardTitle>{t('dashboard.systemStatus')}</CardTitle>
<p className="mt-1 text-xs text-text-tertiary">{t('dashboard.systemStatusHint')}</p>
</div>
</CardHeader>
<CardBody className="space-y-3">
{/* `flex-wrap` + `break-words`: on a narrow rail the badge drops
to the next line instead of squeezing the label down to one
letter. No fixed widths, so nothing can escape the card. */}
<div className="flex min-w-0 flex-wrap items-center justify-between gap-x-2 gap-y-1">
<span className="min-w-0 break-words text-sm text-text-secondary">
{t('dashboard.backendStatus')}
</span>
<Badge variant={backendBadge.variant} dot>
{backendBadge.label}
</Badge>
</div>
{backendStatus === 'offline' && (
<div className="flex items-start gap-2 rounded-md border border-warning-border bg-warning-bg px-2.5 py-2 text-xs text-warning-fg">
<WifiOff className="mt-px size-3.5 shrink-0" />
<span className="min-w-0 break-words">{t('state.loadFailedHint')}</span>
</div>
)}
<div className="flex min-w-0 flex-wrap items-center justify-between gap-x-2 gap-y-1">
<span className="min-w-0 break-words text-sm text-text-secondary">
{t('dashboard.totalAdapters')}
</span>
{loading ? (
<Skeleton shape="line" className="h-4 w-10" />
) : (
<Badge variant={counts.adapters > 0 ? 'success' : 'neutral'}>{counts.adapters}</Badge>
)}
</div>
<div className="flex min-w-0 flex-wrap items-center justify-between gap-x-2 gap-y-1">
<span className="min-w-0 break-words text-sm text-text-secondary">
{t('monitoring.totalMessages')}
</span>
{loading ? (
<Skeleton shape="line" className="h-4 w-10" />
) : (
<Badge variant="neutral">{counts.messages}</Badge>
)}
</div>
</CardBody>
</Card>

<Card padding="none" className="min-w-0">
<CardHeader>
<CardTitle>{t('dashboard.quickActions')}</CardTitle>
Expand Down
Loading
Loading