feat(monitor): 卡片概况与统一文件处理表
build / build (push) Successful in 1m17s

This commit is contained in:
姚章浩
2026-10-27 12:14:19 +08:00
parent d8d143eca0
commit 1b09f7d35b
13 changed files with 2238 additions and 559 deletions
+101 -95
View File
@@ -1,99 +1,105 @@
import { renderToStaticMarkup } from 'react-dom/server'
import { describe,expect,it,vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { WeKnoraMonitorView } from './WeKnoraMonitor'
import type { MonitorFilePage,MonitorOverview,RunMetrics } from './monitor'
import type { TestPublicationPage } from './testPublications'
import type { MonitorTaskPage } from './monitorTasks'
const overview:MonitorOverview={mode:'simulation',simulated:true,observed_at:'2026-09-08T12:00:00Z',host:{cpu_percent:42,memory_used_bytes:19971597926,memory_total_bytes:34359738368,disk_used_bytes:128849018880,disk_total_bytes:536870912000,gpu_state:'unknown',gpu_detail:'未接入真实GPU监控',simulated:true},services:[{key:'weknora',name:'WeKnora API',state:'healthy',detail:'模拟连接正常',latency_ms:86,observed_at:'2026-09-08T12:00:00Z',simulated:true},{key:'mineru',name:'MinerU',state:'healthy',detail:'模拟处理中2,队列5',latency_ms:24,observed_at:'2026-09-08T12:00:00Z',simulated:true},{key:'postgres',name:'PostgreSQL',state:'unknown',detail:'未接入真实监控',latency_ms:0,observed_at:'2026-09-08T12:00:00Z',simulated:true},{key:'redis',name:'Redis / MQ',state:'unknown',detail:'未接入真实监控',latency_ms:0,observed_at:'2026-09-08T12:00:00Z',simulated:true},{key:'oss',name:'OSS',state:'unknown',detail:'未接入真实监控',latency_ms:0,observed_at:'2026-09-08T12:00:00Z',simulated:true}],knowledge_bases:[{id:'kb-sim',name:'公司级技术支持知识库',visibility:'mixed',imported:5750,completed:4530,pending:450,processing:50,finalizing:714,failed:6,cancelled:0,planned:120,needs_removal:3,stale_planned:0,internal_imported:4200,internal_completed:3300,external_imported:1550,external_completed:1230}],pipeline:{fetch_pending:4,fetch_failed:1,fetch_missing:0,concurrency:2},health:[]}
const files:MonitorFilePage={items:[{name:'[模拟] 产品参数总表.xlsx',directory:'02|产品资料',visibility:'external',status:'finalizing',stage_detail:'基础检索可用,Wiki与图谱仍在生成',elapsed_seconds:2100,error_code:''}],total:1,limit:20,offset:0,sample_only:true}
const metrics:RunMetrics={observed_at:'2026-09-12T00:00:00Z',active_workers:2,worker_source:'pg_lease',queue:{pending:3,running:4,retry:1,failed:2,oldest_pending_age_seconds:120},short_window:{window_seconds:3600,jobs_started:50,jobs_completed:48,jobs_failed:6,success_rate:88.9,failure_rate:11.1,duration_avg_seconds:55,duration_p50_seconds:30,duration_p95_seconds:1800},long_window:{window_seconds:86400,jobs_started:500,jobs_completed:482,jobs_failed:18,success_rate:96.4,failure_rate:3.6,duration_avg_seconds:70,duration_p50_seconds:45,duration_p95_seconds:2400}}
const queue:TestPublicationPage={items:[{id:'tp-plan',title:'API.docx',ingest_state:'pending',processing_state:'planned',retrieval_state:'unpublished',target_scope: 'internal', change_set_id: '', change_type:'added',can_start:true,retry_count:0,last_error:'',can_retry:false,updated_at:'2026-09-09T10:01:00Z'},{id:'tp-fetch',title:'焊接手册.pdf',ingest_state:'pending',processing_state:'planned',retrieval_state:'unpublished',target_scope:'external',change_set_id:'',change_type:'added',can_start:false,retry_count:0,last_error:'',can_retry:false,updated_at:'2026-09-09T10:02:00Z'},{id:'tp-failed',title:'CR20A.pdf',ingest_state:'uploaded',processing_state:'failed',retrieval_state:'unpublished',target_scope: 'external', change_set_id: '', change_type:'updated',can_start:false,retry_count:1,last_error:'remote_parse_failed',can_retry:true,updated_at:'2026-09-09T10:00:00Z'}],total:3,limit:50,offset:0}
const plans=queue.items.filter((item)=>item.can_start)
const baseProps={overview,files,queue,plans,selectedKB:overview.knowledge_bases[0],status:'' as const,queueStatus:'' as const,queueScope:'' as const,loading:false,error:null as string|null,retryingIDs:[] as string[],starting:false,startMessage:'',onSelectKB:vi.fn(),onStatus:vi.fn(),onQueueStatus:vi.fn(),onQueueScope:vi.fn(),lane:'queue',onLaneChange:vi.fn(),metrics,onRetry:vi.fn(),onBatchRetry:vi.fn(),onStart:vi.fn(),onRefresh:vi.fn()}
describe('WeKnoraMonitorView',()=>{
it('filters the processing queue by target knowledge base and shows each task target',()=>{
const html=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} queueScope="internal" onQueueScope={vi.fn()} />)
expect(html).toContain('aria-label="队列目标知识库"')
expect(html).toContain('对内知识库</option>')
expect(html).toContain('对外知识库</option>')
expect(html).toContain('<option value="internal" selected="">对内知识库')
expect(html).toContain('目标知识库')
expect(html).toContain('scope-badge internal">对内')
expect(html).toContain('scope-badge external">对外')
})
it('treats the catalog annotation as the only decision: 待入库 lists plans with one 开始处理 button and no reason form',()=>{
const waiting=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane="waiting" onStart={vi.fn()} />)
expect(waiting).toContain('待入库(2)')
expect(waiting).toContain('开始处理(1)')
expect(waiting).toContain('并发上限(当前 2)')
expect(waiting).not.toContain('确认原因')
expect(waiting).not.toContain('操作人<input')
expect(waiting).toContain('正在从源头取回文件')
})
it('shows knowledge-base removal demand from blocked-but-live items',()=>{
const removal=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane="removal" />)
expect(removal).toContain('需下架(3)')
expect(removal).toContain('3 份仍在检索中')
const withItems = renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane="removal" removalItems={[{ id: 'tp-live', title: '相机线束固定孔位尺寸图.pdf', target_scope: 'internal', processing_state: 'completed', ingest_state: 'uploaded', retrieval_state: 'unpublished', source_item_id: 'si-1', source_item_version_id: 'siv-1', knowledge_id: 'knowledge-1', updated_at: '2026-10-10T03:00:00Z', created_at: '2026-10-10T02:00:00Z' } as never]} /> as never)
expect(withItems).toContain('相机线束固定孔位尺寸图.pdf')
expect(withItems).toContain('下架(从测试库移除)')
// 确认态在视图内部(不依赖容器传参):初始渲染必须是普通按钮,且不得出现确认/取消,
// 避免"点一下就直接执行"的降级。
expect(withItems).toContain('下架(从测试库移除)')
expect(withItems).not.toContain('确认下架(从测试库移除)')
})
it('shows inbox lanes for the knowledge-base diff view',()=>{
const attention=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='attention' />)
for(const text of ['需要你出手','CR20A.pdf','remote_parse_failed','失败阶段 文档解析','批量重试所选(1)','死信(重试次数用完,系统不再自动处理)','源头取件”=从钉钉/AList'])expect(attention).toContain(text)
const withFailures=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='attention' failures={[{id:'jf-1',job_id:'job-1',job_type:'artifact.fetch',error_code:'handler_error',attempt:8,max_attempts_at_failure:8,state:'open',created_at:'2026-09-15T01:52:53Z',doc_name:'ATOM整机出厂测试.adoc',last_error:'artifact_fetch_retryable: source_unavailable'}]} />)
expect(withFailures).toContain('「ATOM整机出厂测试.adoc」')
expect(withFailures).toContain('来源服务当时不可达')
const inflight=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='inflight' />)
for(const text of ['处理中','知识库解析进度','已导入 5750','待入库 120','对内 3300 / 4200','对外 1230 / 1550','源头取件 → Hash'])expect(inflight).toContain(text)
const queueView=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='queue' />)
expect(queueView).toContain('全部任务(3)')
expect(queueView).toContain('重试')
expect(queueView).toContain('1小时·成功')
expect(queueView).toContain('88.9%')
const nav=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='waiting' />)
for(const text of ['待入库','需人工处理','需下架','处理中','已完成','全部任务'])expect(nav).toContain(text)
})
it('does not show simulated success totals after a load error without data',()=>{
const html=renderToStaticMarkup(<WeKnoraMonitorView overview={null} files={null} selectedKB={null} status="" queueStatus="" queueScope="" loading={false} error="加载失败" onSelectKB={vi.fn()} onStatus={vi.fn()} onQueueStatus={vi.fn()} onQueueScope={vi.fn()} onRefresh={vi.fn()} />)
expect(html).toContain('加载失败')
expect(html).not.toContain('completed 0')
})
it('keeps attention items visible when they are outside the first queue page',()=>{
const firstPage:TestPublicationPage={items:[queue.items[0]],total:115,limit:50,offset:0}
const attentionItem=queue.items[2]
const html=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} queue={firstPage} attention={[attentionItem]} lane='attention' />)
expect(html).toContain('需要你出手(1)')
expect(html).toContain('CR20A.pdf')
expect(html).toContain('批量重试所选(1)')
})
it('offers to page through the full queue when more rows exist',()=>{
const firstPage:TestPublicationPage={items:queue.items,total:115,limit:50,offset:0}
const html=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} queue={firstPage} lane='queue' onLoadMore={vi.fn()} />)
expect(html).toContain('已显示 3 / 共 115')
expect(html).toContain('加载更多')
})
it('offers 重新入队 for a 源头取件 dead letter that carries no publication id',()=>{
// 取件死信没有 publication_id,所以不能走发布重试链路;没有这个按钮,一个终态
// 取件失败(例如钉钉会话过期)在界面上就永远救不回来。
const failures=[{id:'jf-fetch',job_id:'job-fetch',job_type:'artifact.fetch',error_code:'artifact_invalid',attempt:1,max_attempts_at_failure:8,state:'open' as const,created_at:'2026-10-08T03:20:35Z',doc_name:'关闭PC2远程桌面弹窗.docx',last_error:'artifact_fetch_rejected: http_401'}]
const html=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='attention' failures={failures} onRequeueFailure={vi.fn()} />)
expect(html).toContain('源头取件')
expect(html).toContain('关闭PC2远程桌面弹窗.docx')
expect(html).toContain('重新入队')
const busy=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='attention' failures={failures} requeueingIDs={['jf-fetch']} />)
expect(busy).toContain('重排中…')
expect(busy).not.toContain('>重新入队<')
})
it('does not offer 重新入队 for a 上传解析 dead letter without a publication id',()=>{
const failures=[{id:'jf-upload',job_id:'job-upload',job_type:'test.upload',error_code:'handler_error',attempt:8,max_attempts_at_failure:8,state:'open' as const,created_at:'2026-10-08T03:20:35Z',last_error:'remote_parse_failed'}]
const html=renderToStaticMarkup(<WeKnoraMonitorView {...baseProps} lane='attention' failures={failures} />)
expect(html).toContain('上传解析')
// 段落提示语里始终有“重新入队=再给它一次机会”,所以断言按钮本身不存在。
expect(html).not.toContain('>重新入队</button>')
})
const page: MonitorTaskPage = {
items: [
{
id: 'tp-1',
title: '维护手册.pdf',
path: '产品/维护',
source_id: 's1',
source_name: '技术资料',
target_scope: 'internal',
target_kb: 'test-kb',
action: 'update',
stage: 'parsing',
status: 'attention',
detail: 'remote_parse_failed',
updated_at: '2026-10-27T02:00:00Z',
retry_kind: 'upload',
failure_id: '',
retry_count: 2,
version_id: 'v1',
},
{
id: 'tp-2',
title: '过期资料.pdf',
path: '历史',
source_id: 's1',
source_name: '技术资料',
target_scope: 'external',
target_kb: 'test-public',
action: 'remove',
stage: 'finished',
status: 'completed',
detail: '已从测试库移除;来源文件保留',
updated_at: '2026-10-27T02:01:00Z',
retry_kind: '',
failure_id: '',
retry_count: 0,
version_id: 'v2',
},
],
total: 145,
limit: 20,
offset: 0,
sources: [{ id: 's1', name: '技术资料' }],
targets: [],
retryable: 1,
}
const props = {
overview: null,
metrics: null,
page,
loading: false,
error: '',
message: '',
filters: { q: '', source: '', scope: '', target: '', action: '', status: 'active', stage: '', since: '', until: '' },
selected: [],
busy: false,
canOperate: true,
onFilters: vi.fn(),
onPage: vi.fn(),
onSelection: vi.fn(),
onSelectAll: vi.fn(),
onRetry: vi.fn(),
onDetail: vi.fn(),
onRefresh: vi.fn(),
}
describe('unified monitor', () => {
it('shows metric cards before a single server-paginated file table without manual start or lane tabs', () => {
const html = renderToStaticMarkup(<WeKnoraMonitorView {...props} />)
expect(html).toContain('monitor-metric-grid')
expect(html.indexOf('monitor-metric-grid')).toBeLessThan(html.indexOf('<h2>文件处理</h2>'))
expect(html.match(/<table/g)).toHaveLength(1)
for (const s of [
'维护手册.pdf',
'过期资料.pdf',
'处理动作',
'当前阶段',
'处理状态',
'状态说明',
'共 145',
'重试所选',
'服务与依赖',
])
expect(html).toContain(s)
expect(html).not.toContain('开始处理')
expect(html).not.toContain('role="tab"')
expect(html).toContain('value="active" selected=""')
})
it('does not claim healthy zeroes or 100% when metrics are unavailable', () => {
const html = renderToStaticMarkup(<WeKnoraMonitorView {...props} error="无法读取运行指标" />)
expect(html).toContain('无法读取运行指标')
expect(html).not.toContain('100%')
expect(html).toContain('尚未取得服务状态')
})
it('keeps removal semantics and does not offer retry for completed rows', () => {
const html = renderToStaticMarkup(<WeKnoraMonitorView {...props} />)
expect(html).toContain('已从测试库移除;来源文件保留')
expect(html).toContain('aria-label="选择维护手册.pdf"')
expect(html).not.toContain('aria-label="选择过期资料.pdf"')
})
})
+735 -464
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { fetchMonitorTasks } from './monitorTasks'
import { healthLabel } from './WeKnoraMonitor'
import type { ServiceHealth } from './monitor'
afterEach(() => vi.unstubAllGlobals())
describe('monitor table contract', () => {
it('rejects malformed facets instead of rendering a broken selector', async () => {
vi.stubGlobal(
'fetch',
vi.fn().mockResolvedValue({
ok: true,
json: async () => ({
data: {
items: [],
total: 0,
limit: 20,
offset: 0,
retryable: 0,
sources: [{ id: 7, name: 'bad' }],
targets: [],
},
}),
})
)
await expect(fetchMonitorTasks({ status: 'active' })).rejects.toThrow('筛选项')
})
it('passes the filter and page to the server without client-side totals', async () => {
const data = { items: [], total: 145, limit: 20, offset: 40, retryable: 12, sources: [], targets: [] }
const request = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ data }) })
vi.stubGlobal('fetch', request)
const result = await fetchMonitorTasks({ status: 'attention', action: 'remove', q: '手册' }, 40)
expect(result.total).toBe(145)
expect(result.retryable).toBe(12)
const url = new URL(request.mock.calls[0][0], 'http://localhost')
expect(url.searchParams.get('offset')).toBe('40')
expect(url.searchParams.get('action')).toBe('remove')
expect(url.searchParams.get('q')).toBe('手册')
})
it('distinguishes unknown, unconfigured, blocked and inapplicable services', () => {
const s = { applicable: true, configured: true, readiness: 'unknown' } as ServiceHealth
expect(healthLabel(s)).toBe('未确认')
expect(healthLabel({ ...s, configured: false })).toBe('未配置')
expect(healthLabel({ ...s, applicable: false })).toBe('不适用')
expect(healthLabel({ ...s, readiness: 'blocked' })).toBe('阻断')
})
})
+129
View File
@@ -0,0 +1,129 @@
export interface MonitorTask {
history?: { at: string; kind: string; detail: string }[]
id: string
title: string
path: string
source_id: string
source_name: string
target_scope: string
target_kb: string
action: string
stage: string
status: string
detail: string
updated_at: string
retry_kind: string
failure_id: string
retry_count: number
version_id: string
}
export interface MonitorTaskPage {
items: MonitorTask[]
total: number
limit: number
offset: number
sources: { id: string; name: string }[]
targets: { id: string; name: string }[]
retryable: number
}
export interface MonitorFilters {
q: string
source: string
scope: string
target: string
action: string
status: string
stage: string
since: string
until: string
}
export const defaultMonitorFilters: MonitorFilters = {
q: '',
source: '',
scope: '',
target: '',
action: '',
status: 'active',
stage: '',
since: '',
until: '',
}
export const actionLabels: Record<string, string> = { add: '新增', update: '更新', remove: '移除' }
export const stageLabels: Record<string, string> = {
waiting: '等待调度',
fetch: '取件',
upload: '上传',
parsing: '解析',
indexing: '索引增强',
removal: '测试库移除',
finished: '结束',
}
export const taskStatusLabels: Record<string, string> = {
waiting: '等待中',
running: '执行中',
retrying: '重试中',
attention: '需人工处理',
completed: '已完成',
cancelled: '已取消',
}
export const canRetryTask = (item: MonitorTask) =>
item.status === 'attention' && ['upload', 'fetch', 'remove'].includes(item.retry_kind)
const record = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null
export async function fetchMonitorTasks(
filters: Partial<MonitorFilters> & { id?: string },
offset = 0,
limit = 20,
signal?: AbortSignal
): Promise<MonitorTaskPage> {
const query = new URLSearchParams({ limit: String(limit), offset: String(offset) })
Object.entries(filters).forEach(([k, v]) => {
if (v) query.set(k, v)
})
const response = await fetch(`/api/v1/monitor/tasks?${query}`, { headers: { Accept: 'application/json' }, signal })
if (!response.ok) throw new Error(`加载文件处理状态失败(HTTP ${response.status})`)
const value: unknown = await response.json()
if (!record(value) || !record(value.data)) throw new Error('文件处理响应无效')
const d = value.data
const count = (v: unknown) => Number.isInteger(v) && Number(v) >= 0
if (
!Array.isArray(d.items) ||
!count(d.total) ||
!count(d.limit) ||
!count(d.offset) ||
!count(d.retryable) ||
!Array.isArray(d.sources) ||
!Array.isArray(d.targets)
)
throw new Error('文件处理分页响应无效')
for (const item of d.items) {
if (
!record(item) ||
![
'id',
'title',
'path',
'source_id',
'source_name',
'target_scope',
'target_kb',
'action',
'stage',
'status',
'detail',
'updated_at',
'retry_kind',
'failure_id',
'version_id',
].every((k) => typeof item[k] === 'string') ||
!count(item.retry_count) ||
!Object.hasOwn(actionLabels, String(item.action)) ||
!Object.hasOwn(stageLabels, String(item.stage)) ||
!Object.hasOwn(taskStatusLabels, String(item.status))
)
throw new Error('文件处理条目无效')
}
for (const option of [...d.sources, ...d.targets])
if (!record(option) || typeof option.id !== 'string' || typeof option.name !== 'string')
throw new Error('文件处理筛选项无效')
return d as unknown as MonitorTaskPage
}
+465
View File
@@ -0,0 +1,465 @@
.monitor-workbench {
max-width: 1800px;
color: var(--ink-base);
}
.monitor-workbench button {
box-shadow: none;
}
.monitor-heading {
display: flex;
align-items: center;
gap: 14px;
margin-bottom: 20px;
}
.monitor-heading h1 {
font-size: 24px;
margin: 0 0 5px;
}
.monitor-heading p {
margin: 0;
color: var(--ink-mute);
font-size: 12px;
}
.monitor-heading > span {
margin-left: auto;
color: var(--ink-mute);
font-size: 11px;
}
.monitor-metric-grid {
display: grid;
grid-template-columns: 1fr 1fr 1.3fr 1.1fr;
gap: 14px;
margin-bottom: 15px;
}
.monitor-metric-grid article {
min-width: 0;
padding: 18px;
border: 1px solid var(--border-base);
border-radius: 9px;
background: var(--bg-panel);
}
.monitor-metric-grid h2 {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
font-size: 12px;
font-weight: 500;
color: var(--ink-mute);
margin: 0;
}
.monitor-metric-grid h2 small {
font-size: 10px;
color: var(--ink-faint);
}
.monitor-numbers {
display: flex;
justify-content: space-between;
gap: 12px;
margin-top: 15px;
}
.monitor-numbers > div {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
}
.monitor-numbers strong {
font-size: 27px;
line-height: 1.3;
font-weight: 700;
letter-spacing: -0.6px;
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.monitor-numbers span {
font-size: 11px;
color: var(--ink-mute);
}
.monitor-numbers .monitor-memory {
font-size: 23px;
}
.monitor-good {
color: var(--c-done) !important;
}
.monitor-bad {
color: var(--c-fail) !important;
}
.monitor-service-panel,
.monitor-files {
border: 1px solid var(--border-base);
border-radius: 9px;
background: var(--bg-panel);
overflow: hidden;
}
.monitor-service-panel {
padding: 15px 18px;
margin-bottom: 22px;
}
.monitor-section-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.monitor-section-heading h2 {
font-size: 16px;
margin: 0;
font-weight: 650;
}
.monitor-section-heading > span {
font-size: 11px;
color: var(--ink-mute);
}
.monitor-service-grid {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 9px;
margin-top: 13px;
align-items: start;
}
.monitor-service {
border: 1px solid var(--border-base);
border-radius: 6px;
background: var(--bg-soft);
padding: 10px 11px;
font-size: 12px;
min-width: 0;
}
.monitor-service summary {
list-style: none;
cursor: pointer;
display: flex;
flex-direction: column;
gap: 6px;
}
.monitor-service summary::-webkit-details-marker {
display: none;
}
.monitor-service summary > span {
overflow-wrap: anywhere;
}
.monitor-service b {
font-size: 11px;
font-weight: 500;
color: var(--ink-mute);
}
.monitor-service p,
.monitor-service small {
font-size: 11px;
color: var(--ink-mute);
overflow-wrap: anywhere;
line-height: 1.6;
}
.monitor-files > .monitor-section-heading {
padding: 18px 19px 10px;
}
.monitor-filters {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
padding: 10px 19px 16px;
}
.monitor-filters input,
.monitor-filters select {
border: 1px solid var(--border-strong);
border-radius: 6px;
padding: 8px 10px;
background: var(--bg-panel);
color: var(--ink-base);
font: inherit;
font-size: 12px;
max-width: 230px;
min-height: 35px;
}
.monitor-filters > input {
width: 210px;
}
.monitor-time-filter {
font-size: 12px;
color: var(--ink-mute);
}
.monitor-time-filter summary {
cursor: pointer;
}
.monitor-time-filter label {
display: flex;
gap: 8px;
align-items: center;
margin-top: 8px;
}
.monitor-batch {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
padding: 11px 19px;
background: var(--c-run-bg);
border-top: 1px solid var(--c-run-border);
border-bottom: 1px solid var(--c-run-border);
font-size: 12px;
}
.monitor-batch b {
color: var(--c-run);
}
.monitor-batch > span {
color: var(--ink-mute);
}
.monitor-batch > .primary {
margin-left: auto;
}
.monitor-workbench .primary {
background: var(--c-run);
border-color: var(--c-run);
color: #fff;
}
.monitor-workbench button:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.monitor-workbench .monitor-link {
padding: 4px 6px;
background: transparent;
color: var(--c-run);
border: 0;
border-radius: 4px;
font-size: 12px;
white-space: nowrap;
}
.monitor-table-scroll {
overflow: auto;
}
.monitor-unified-table {
width: 100%;
min-width: 1180px;
border-collapse: collapse;
table-layout: fixed;
text-align: left;
}
.monitor-unified-table th {
padding: 12px 9px;
background: var(--bg-soft);
font-size: 11px;
font-weight: 500;
color: var(--ink-mute);
border-bottom: 1px solid var(--border-base);
white-space: normal;
}
.monitor-unified-table td {
padding: 14px 9px;
font-size: 12px;
line-height: 1.6;
border-bottom: 1px solid var(--border-base);
vertical-align: middle;
white-space: normal;
overflow-wrap: anywhere;
}
.monitor-unified-table tr:last-child td {
border-bottom: 0;
}
.monitor-unified-table td small {
display: block;
font-size: 10px;
color: var(--ink-mute);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 3px;
}
.monitor-file-name {
display: block;
font-size: 13px;
line-height: 1.6;
font-weight: 550;
}
.monitor-unified-table input {
accent-color: var(--c-run);
width: 14px;
height: 14px;
}
.monitor-unified-table tr:hover,
.monitor-selected {
background: var(--c-run-bg);
}
.monitor-state,
.monitor-scope {
display: inline-block;
font-size: 11px;
padding: 2px 7px;
border-radius: 4px;
white-space: nowrap;
background: var(--c-run-bg);
color: var(--c-run);
}
.monitor-state.attention {
background: var(--c-fail-bg);
color: var(--c-fail);
}
.monitor-state.completed {
background: var(--c-done-bg);
color: var(--c-done);
}
.monitor-state.retrying {
background: var(--c-warn-bg);
color: var(--c-warn);
}
.monitor-state.waiting,
.monitor-state.cancelled {
background: var(--c-dead-bg);
color: var(--c-dead);
}
.monitor-pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 13px 19px;
border-top: 1px solid var(--border-base);
font-size: 11px;
color: var(--ink-mute);
}
.monitor-pagination > div {
display: flex;
align-items: center;
gap: 12px;
}
.monitor-pagination button {
font-size: 11px;
padding: 6px 10px;
}
.monitor-unified-table .monitor-empty {
text-align: center;
padding: 45px 20px;
color: var(--ink-mute);
}
.monitor-alert {
padding: 11px 15px;
border: 1px solid var(--c-warn-border);
background: var(--c-warn-bg);
color: var(--c-warn);
border-radius: 6px;
font-size: 12px;
margin-bottom: 14px;
overflow-wrap: anywhere;
}
.monitor-result {
padding: 12px 19px;
font-size: 12px;
line-height: 1.8;
border-bottom: 1px solid var(--border-base);
overflow-wrap: anywhere;
}
.monitor-muted {
font-size: 12px;
color: var(--ink-mute);
line-height: 1.8;
}
.monitor-drawer {
position: fixed;
inset: 0 0 0 auto;
width: min(480px, 100vw);
height: 100dvh;
max-height: 100dvh;
max-width: 100vw;
margin: 0;
border: 0;
border-left: 1px solid var(--border-base);
padding: 25px;
background: var(--bg-panel);
color: var(--ink-base);
overflow: auto;
box-shadow: -10px 0 35px #10204020;
}
.monitor-drawer::backdrop {
background: #15253f35;
}
.monitor-drawer header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.monitor-drawer h2 {
font-size: 19px;
}
.monitor-drawer h3 {
font-size: 17px;
overflow-wrap: anywhere;
}
.monitor-drawer dl > div {
display: grid;
grid-template-columns: 90px 1fr;
gap: 12px;
padding: 12px 0;
border-bottom: 1px solid var(--border-base);
font-size: 12px;
line-height: 1.7;
}
.monitor-drawer dt {
color: var(--ink-mute);
}
.monitor-drawer dd {
margin: 0;
overflow-wrap: anywhere;
}
.monitor-workbench :focus-visible,
.monitor-drawer :focus-visible {
outline: 2px solid var(--c-run);
outline-offset: 3px;
}
@media (max-width: 1200px) {
.monitor-metric-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.monitor-service-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
@media (max-width: 760px) {
.monitor-heading {
flex-wrap: wrap;
}
.monitor-heading > span {
margin-left: 0;
}
.monitor-service-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.monitor-metric-grid {
gap: 8px;
}
.monitor-metric-grid article {
padding: 12px;
}
.monitor-metric-grid h2 {
flex-wrap: wrap;
}
.monitor-numbers {
gap: 6px;
}
.monitor-numbers strong,
.monitor-numbers .monitor-memory {
font-size: 20px;
}
.monitor-batch > span {
display: none;
}
.monitor-section-heading {
align-items: flex-start;
flex-direction: column;
}
.monitor-pagination {
padding: 12px;
}
.monitor-filters {
padding: 12px;
}
.monitor-filters > input {
width: 100%;
max-width: none;
}
.monitor-drawer {
padding: 18px;
}
}