diff --git a/cmd/api/main.go b/cmd/api/main.go index 8c6f57e..b3d65a2 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -259,6 +259,7 @@ func run(ctx context.Context, getenv func(string) string) error { ConfirmConcurrency: config.ReconciliationConfirmConcurrency, KeepRuns: config.ReconciliationKeepRuns, MaxAge: config.ReconciliationMaxAge, + WeKnoraWebBase: testEndpointResolver, }) if serviceErr != nil { return serviceErr diff --git a/cmd/worker/main.go b/cmd/worker/main.go index 79b9151..9f3ee9f 100644 --- a/cmd/worker/main.go +++ b/cmd/worker/main.go @@ -293,6 +293,12 @@ func run(ctx context.Context, getenv func(string) string) error { ConfirmConcurrency: config.ReconciliationConfirmConcurrency, KeepRuns: config.ReconciliationKeepRuns, MaxAge: config.ReconciliationMaxAge, + WeKnoraWebBase: func(resolveCtx context.Context) string { + if kbBindings != nil { + return kbBindings.ResolveBaseURL(resolveCtx, kbbinding.EnvTest) + } + return config.TestWeKnoraBaseURL + }, }) if err != nil { return err diff --git a/internal/httpapi/monitor_tasks.go b/internal/httpapi/monitor_tasks.go index 4ad5a0f..4aaa195 100644 --- a/internal/httpapi/monitor_tasks.go +++ b/internal/httpapi/monitor_tasks.go @@ -73,7 +73,7 @@ func listMonitorTasks(w http.ResponseWriter, r *http.Request, config Config) { writeJSON(w, 400, map[string]string{"error": "invalid filter"}) return } - for _, pair := range [][2]string{{f.Scope, "|internal|external"}, {f.Action, "|add|update|remove"}, {f.Status, "|active|waiting|running|retrying|attention|completed|cancelled"}, {f.Stage, "|waiting|fetch|upload|parsing|indexing|removal|finished"}} { + for _, pair := range [][2]string{{f.Scope, "|internal|external"}, {f.Action, "|add|update|remove"}, {f.Status, "|active|waiting|running|retrying|attention|completed|cancelled"}, {f.Stage, "|waiting|fetch|upload|parsing|indexing|removal|finished|weknora"}} { if !strings.Contains("|"+pair[1]+"|", "|"+pair[0]+"|") { writeJSON(w, 400, map[string]string{"error": "invalid filter"}) return diff --git a/internal/httpapi/monitor_tasks_test.go b/internal/httpapi/monitor_tasks_test.go index 00a558c..ee90c21 100644 --- a/internal/httpapi/monitor_tasks_test.go +++ b/internal/httpapi/monitor_tasks_test.go @@ -33,6 +33,13 @@ func TestMonitorTasksRoute(t *testing.T) { if s.filter.Status != "active" || s.filter.Offset != 40 { t.Fatalf("filter %#v", s.filter) } + // §8 merges 解析/索引增强 into one "WeKnora 处理中" facet. + merged := httptest.NewRequest("GET", "/api/v1/monitor/tasks?stage=weknora", nil).WithContext(req.Context()) + wm := httptest.NewRecorder() + h.ServeHTTP(wm, merged) + if wm.Code != 200 || s.filter.Stage != "weknora" { + t.Fatalf("weknora stage: %d filter %#v", wm.Code, s.filter) + } for _, query := range []string{"status=garbage", "stage=internal&scope=internal", "limit=101", "offset=-1", "since=bad"} { r := httptest.NewRequest("GET", "/api/v1/monitor/tasks?"+query, nil).WithContext(req.Context()) rr := httptest.NewRecorder() diff --git a/internal/monitoring/health.go b/internal/monitoring/health.go index 60e3a73..ec5579b 100644 --- a/internal/monitoring/health.go +++ b/internal/monitoring/health.go @@ -306,11 +306,10 @@ func (provider *RealProvider) Services(ctx context.Context) []governance.Service health = append(health, provider.weKnoraProbe(ctx, now)) health = append(health, provider.productionWeKnoraProbe(ctx, now)) health = append(health, provider.httpProbe(ctx, "mineru", "MinerU", provider.minerUBaseURL, now)) - // Not-applicable dependencies stay explicit (embedding/llm managed by - // WeKnora, redis/mq/oss not deployed). + // Not-applicable dependencies stay explicit (redis/mq/oss not deployed). + // Embedding/LLM are managed inside WeKnora and are not platform services; + // listing them here produced two permanent "unknown" cards on the page. health = append(health, - provider.track(classify("embedding", "Embedding模型", false, false, ProbeOutcome{ObservedAt: now})), - provider.track(classify("llm", "LLM模型", false, false, ProbeOutcome{ObservedAt: now})), provider.track(classify("redis", "Redis / MQ", false, false, ProbeOutcome{ObservedAt: now})), provider.track(classify("oss", "OSS", false, false, ProbeOutcome{ObservedAt: now})), ) diff --git a/internal/monitoring/p10_health_integration_test.go b/internal/monitoring/p10_health_integration_test.go index 7d68c2d..5f35cfd 100644 --- a/internal/monitoring/p10_health_integration_test.go +++ b/internal/monitoring/p10_health_integration_test.go @@ -59,11 +59,18 @@ func TestRealServicesHealthMatrix(t *testing.T) { if byKey["weknora-production/r"] != ReadNotConfigured || byKey["weknora-production/l"] != LiveUnknown { t.Fatalf("unconfigured production endpoint = %v/%v", byKey["weknora-production/l"], byKey["weknora-production/r"]) } - for _, key := range []string{"redis", "oss", "embedding", "llm"} { + for _, key := range []string{"redis", "oss"} { if byKey[key+"/r"] != ReadNotApplicable || byKey[key+"/l"] != LiveUnknown { t.Fatalf("not-deployed %s = %v/%v", key, byKey[key+"/l"], byKey[key+"/r"]) } } + // Embedding/LLM belong to WeKnora; the platform must not render them as + // permanent unknown cards (requirement §8). + for _, key := range []string{"embedding", "llm"} { + if _, ok := byKey[key+"/r"]; ok { + t.Fatalf("platform health still lists %s", key) + } + } // Readiness must be blocked ONLY by configured+deployed failures: worker. ok, blocked := overallReadiness(health) if ok || len(blocked) != 1 || blocked[0] != "worker" { diff --git a/internal/monitoring/reconciliation_removal_integration_test.go b/internal/monitoring/reconciliation_removal_integration_test.go index 49fe302..c731176 100644 --- a/internal/monitoring/reconciliation_removal_integration_test.go +++ b/internal/monitoring/reconciliation_removal_integration_test.go @@ -32,10 +32,13 @@ func TestOverviewRemovalDemandAndSharedViewAgree(t *testing.T) { exec(`INSERT INTO source_items(id,source_connection_id,stable_external_id,canonical_uri_hash,title,item_type,policy_state) VALUES('si-recon-view','conn-recon-view','recon.md',repeat('b',64),'对账视图','file','blocked')`) exec(`INSERT INTO source_item_versions(id,source_item_id,revision,content_state) VALUES('sv-recon-view','si-recon-view','r1','verified')`) + // test_publications is unique on (source_item_version_id,test_kb_id): a second + // publication in the same KB must point at its own version, not reuse r1. + exec(`INSERT INTO source_item_versions(id,source_item_id,revision,content_state) VALUES('sv-recon-removing','si-recon-view','r2','verified')`) exec(`INSERT INTO test_publications(id,source_item_version_id,test_kb_id,knowledge_id,ingest_state,processing_state,retrieval_state) VALUES('pub-recon-view','sv-recon-view','kb-recon-view','doc-recon-view','uploaded','completed','unpublished')`) exec(`INSERT INTO test_publications(id,source_item_version_id,test_kb_id,knowledge_id,ingest_state,processing_state,retrieval_state) -VALUES('pub-recon-removing','sv-recon-view','kb-recon-view','doc-recon-removing','uploaded','completed','disabling')`) +VALUES('pub-recon-removing','sv-recon-removing','kb-recon-view','doc-recon-removing','uploaded','completed','disabling')`) provider, err := NewRealProvider(RealProviderConfig{DB: metricsPool{pool: pool}}) if err != nil { diff --git a/internal/platform/postgres/monitor_tasks.go b/internal/platform/postgres/monitor_tasks.go index f359ae4..81c0377 100644 --- a/internal/platform/postgres/monitor_tasks.go +++ b/internal/platform/postgres/monitor_tasks.go @@ -145,7 +145,7 @@ const monitorTasksCTE = `WITH history_publications AS ( SELECT * FROM projected WHERE ($1='' OR strpos(lower(title || ' ' || path),lower($1))>0) AND ($2='' OR source_id=$2) AND ($3='' OR target_scope=$3) AND ($4='' OR action=$4) AND ($5='' OR ($5='active' AND status NOT IN ('completed','cancelled')) OR status=$5) - AND ($6='' OR stage=$6) AND ($7='' OR id=$7) AND ($10='' OR target_kb=$10) + AND ($6='' OR stage=$6 OR ($6='weknora' AND stage IN ('parsing','indexing'))) AND ($7='' OR id=$7) AND ($10='' OR target_kb=$10) AND ($11='' OR updated_at>=NULLIF($11,'')::timestamptz) AND ($12='' OR updated_at<=NULLIF($12,'')::timestamptz) ) ` diff --git a/internal/platform/postgres/reconciliation_store.go b/internal/platform/postgres/reconciliation_store.go index 68eaff7..7b23f1d 100644 --- a/internal/platform/postgres/reconciliation_store.go +++ b/internal/platform/postgres/reconciliation_store.go @@ -97,8 +97,8 @@ func (s *Store) ReapStaleReconciliationRuns(ctx context.Context, now time.Time, return 0, nil } tag, err := s.db.Exec(ctx, `UPDATE reconciliation_runs -SET state='failed',finished_at=$2,error_code='stale_timeout' -WHERE state='running' AND started_at < $3`, now, now.Add(-threshold)) +SET state='failed',finished_at=$1,error_code='stale_timeout' +WHERE state='running' AND started_at < $2`, now, now.Add(-threshold)) if err != nil { return 0, fmt.Errorf("reap stale reconciliation runs: %w", err) } @@ -222,6 +222,13 @@ WHERE id=$1 AND state='running'`, run.ID, run.FinishedAt, run.LedgerCount, run.K return ErrReconciliationNotRunning } for _, finding := range findings { + // The column default only applies when the insert omits the column; the + // service always fills it, but direct callers may pass "" and must not + // violate the check constraint. + confirmation := finding.ConfirmationState + if confirmation == "" { + confirmation = "confirmed" + } if _, err := tx.Exec(ctx, `INSERT INTO reconciliation_findings (id,run_id,finding_type,publication_id,knowledge_id,title,path,source,target_scope, ledger_state,weknora_parse_status,normalized_state,ledger_sha256,declared_sha256, @@ -231,7 +238,7 @@ VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,'open' finding.ID, finding.RunID, finding.Type, finding.PublicationID, finding.DocumentID, finding.Title, finding.Path, finding.Source, finding.TargetScope, finding.LedgerState, finding.WeKnoraParseState, finding.NormalizedState, finding.LedgerSHA256, finding.DeclaredSHA256, - finding.WeKnoraFileMD5, finding.EvidenceLevel, finding.ConfirmationState, finding.Detail, + finding.WeKnoraFileMD5, finding.EvidenceLevel, confirmation, finding.Detail, finding.SuggestedAction, finding.WeKnoraURL, run.FinishedAt); err != nil { return fmt.Errorf("insert reconciliation finding: %w", err) } diff --git a/internal/platform/weknora/client_test.go b/internal/platform/weknora/client_test.go index b288660..45ccb2b 100644 --- a/internal/platform/weknora/client_test.go +++ b/internal/platform/weknora/client_test.go @@ -336,6 +336,26 @@ func TestClientProvidesPaginatedInventoryChunkAndScopedSearchReads(t *testing.T) } } +// Acceptance #16: the reconciliation scan must be one 1000-per-page read, and +// the wire query is the evidence — not just the constant passed to the interface. +func TestListKnowledgeSendsScanPageSizeOnTheWire(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Query().Get("page") != "1" || r.URL.Query().Get("page_size") != "1000" { + t.Fatalf("knowledge list query = %s", r.URL.RawQuery) + } + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"success":true,"data":[],"total":0,"page":1,"page_size":1000}`)) + })) + defer server.Close() + client, err := NewClient(ClientConfig{BaseURL: server.URL, APIKey: "test-api-key", Timeout: time.Second}) + if err != nil { + t.Fatal(err) + } + if _, _, err := client.ListKnowledge(context.Background(), "kb-1", 1, 1000); err != nil { + t.Fatal(err) + } +} + func TestClientRejectsRedirectWithoutForwardingAPIKey(t *testing.T) { var targetHits atomic.Int32 target := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/internal/reconciliation/scan.go b/internal/reconciliation/scan.go index 0f3f818..7b601ef 100644 --- a/internal/reconciliation/scan.go +++ b/internal/reconciliation/scan.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/hex" "fmt" + "net/url" "sort" "strings" "sync" @@ -152,6 +153,11 @@ func (s *Service) buildFindings(ctx context.Context, run governance.Reconciliati } finding.ActionState = "open" finding.ID = deterministicFindingID(run.ID, finding) + if finding.WeKnoraURL == "" && run.KBID != "" && s.weKnoraWebBase != nil { + if base := strings.TrimSpace(s.weKnoraWebBase(ctx)); base != "" { + finding.WeKnoraURL = strings.TrimSuffix(base, "/") + "/platform/knowledge-bases/" + url.PathEscape(run.KBID) + } + } findings = append(findings, finding) } diff --git a/internal/reconciliation/service.go b/internal/reconciliation/service.go index 4e9347b..a3020d0 100644 --- a/internal/reconciliation/service.go +++ b/internal/reconciliation/service.go @@ -72,6 +72,9 @@ type Config struct { ConfirmConcurrency int KeepRuns int MaxAge time.Duration + // WeKnoraWebBase resolves the WeKnora origin used to build the finding's + // jump link. Empty or nil leaves weknora_url empty, which the contract allows. + WeKnoraWebBase func(context.Context) string } type Service struct { @@ -86,6 +89,7 @@ type Service struct { confirmConcurrency int keepRuns int maxAge time.Duration + weKnoraWebBase func(context.Context) string } func New(config Config) (*Service, error) { @@ -120,6 +124,7 @@ func New(config Config) (*Service, error) { store: config.Store, remote: config.Remote, runtime: config.Runtime, queue: config.Queue, now: config.Now, grace: config.Grace, stallAfter: config.StallAfter, staleAfter: config.StaleAfter, confirmConcurrency: config.ConfirmConcurrency, keepRuns: config.KeepRuns, maxAge: config.MaxAge, + weKnoraWebBase: config.WeKnoraWebBase, }, nil } diff --git a/internal/reconciliation/service_test.go b/internal/reconciliation/service_test.go index e722bd2..ed90179 100644 --- a/internal/reconciliation/service_test.go +++ b/internal/reconciliation/service_test.go @@ -3,6 +3,7 @@ package reconciliation import ( "context" "errors" + "strings" "testing" "time" @@ -203,7 +204,8 @@ func TestExecuteRunFindsR1ToR8WithoutRemoteWrites(t *testing.T) { } service, err := New(Config{Store: store, Remote: remote, Now: func() time.Time { return now }, Grace: 30 * time.Minute, StallAfter: 2 * time.Hour, StaleAfter: 6 * time.Hour, - ConfirmConcurrency: 1, KeepRuns: 30, MaxAge: 90 * 24 * time.Hour}) + ConfirmConcurrency: 1, KeepRuns: 30, MaxAge: 90 * 24 * time.Hour, + WeKnoraWebBase: func(context.Context) string { return "https://test.example/" }}) if err != nil { t.Fatal(err) } @@ -234,6 +236,44 @@ func TestExecuteRunFindsR1ToR8WithoutRemoteWrites(t *testing.T) { if store.completedRun.Counts["R8"] != 1 || store.completedRun.LedgerCount != len(ledger) || store.completedRun.KBCount != len(items) { t.Fatalf("run counts = %#v", store.completedRun) } + // Every finding carries the WeKnora jump link built from the resolved test + // origin; an empty base would leave it empty, but a resolved one must not. + for _, finding := range store.findings { + if finding.WeKnoraURL != "https://test.example/platform/knowledge-bases/kb-1" { + t.Fatalf("%s weknora_url = %q", finding.Type, finding.WeKnoraURL) + } + } +} + +// Two ledger publications may legitimately hold the same bytes in one test KB +// (adoption). R8 is keyed by publication_id, so that case must stay silent. +func TestR8DoesNotFlagAdoptedDuplicatesWithDistinctPublications(t *testing.T) { + now := time.Date(2026, 12, 1, 12, 0, 0, 0, time.UTC) + sha := strings.Repeat("a", 64) + md5 := strings.Repeat("b", 32) + row := func(pub, doc string) governance.ReconciliationLedgerRow { + return governance.ReconciliationLedgerRow{ + PublicationID: pub, KnowledgeID: doc, ProcessingState: "completed", RetrievalState: "unpublished", + TargetScope: "internal", Title: doc, SHA256: sha, UploadMD5: md5, UpdatedAt: now.Add(-time.Hour), + } + } + ledger := []governance.ReconciliationLedgerRow{row("pub-a", "doc-a"), row("pub-b", "doc-b")} + items := []weknora.Knowledge{ + {ID: "doc-a", KnowledgeBaseID: "kb-1", Channel: "governance", ParseStatus: "completed", FileHash: md5, Metadata: map[string]any{"publication_id": "pub-a", "content_sha256": sha}}, + {ID: "doc-b", KnowledgeBaseID: "kb-1", Channel: "governance", ParseStatus: "completed", FileHash: md5, Metadata: map[string]any{"publication_id": "pub-b", "content_sha256": sha}}, + } + service, err := New(Config{Store: &fakeReconciliationStore{}, Remote: &fakeReconciliationRemote{}, Now: func() time.Time { return now }}) + if err != nil { + t.Fatal(err) + } + run := governance.ReconciliationRun{ID: "run-1", KBID: "kb-1", StartedAt: now} + findings, err := service.buildFindings(context.Background(), run, ledger, items, false) + if err != nil { + t.Fatal(err) + } + if len(findings) != 0 { + t.Fatalf("adopted duplicates produced findings: %#v", findings) + } } func TestExecuteRunFailsWholeBatchWithoutFindings(t *testing.T) { diff --git a/web/src/ReconciliationFindings.test.tsx b/web/src/ReconciliationFindings.test.tsx index d1d13de..4fc271c 100644 --- a/web/src/ReconciliationFindings.test.tsx +++ b/web/src/ReconciliationFindings.test.tsx @@ -1,6 +1,6 @@ import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it, vi } from 'vitest' -import { ReconciliationFindingsView } from './ReconciliationFindings' +import { FindingDetail, ReconciliationFindingsView } from './ReconciliationFindings' import type { ReconciliationFinding, ReconciliationRun } from './reconciliationApi' const run: ReconciliationRun = { @@ -103,4 +103,14 @@ describe('reconciliation findings', () => { const failed = renderToStaticMarkup() expect(failed).toContain('读取对账批次失败') }) + it('links a finding to WeKnora when the backend supplies a URL', () => { + const html = renderToStaticMarkup( + + ) + expect(html).toContain('href="https://weknora.test/platform/knowledge-bases/kb-1"') + expect(html).toContain('在 WeKnora 中打开') + }) }) diff --git a/web/src/ReconciliationFindings.tsx b/web/src/ReconciliationFindings.tsx index c0defaa..c157f70 100644 --- a/web/src/ReconciliationFindings.tsx +++ b/web/src/ReconciliationFindings.tsx @@ -62,11 +62,42 @@ interface FindingsProps { onDetail: (finding: ReconciliationFinding) => void } +// ServiceStrip is the page-top one-line status required by §8: the service and +// dependency area collapses into a row on both tabs. Queue truth comes from +// weknora_queues; an unavailable queue is stated, never rendered as a zero. +export function ServiceStrip({ overview }: { overview: MonitorOverview | null }) { + const queue = overview?.weknora_queues + const ready = overview?.health.filter((item) => item.readiness === 'ready').length + const attention = overview?.health.filter( + (item) => item.applicable && item.configured && item.readiness !== 'ready' + ).length + return ( +
+ + WeKnora 队列: + {queue ? ( + + {queue.queues.reduce((sum, item) => sum + item.pending, 0)} 等待 ·{' '} + {queue.queues.reduce((sum, item) => sum + item.active, 0)} 运行 + + ) : ( + 未配置只读 Key 或队列不可用 + )} + + + 服务: + {ready == null ? '等待运行快照' : `${ready} 可接单`} + {attention ? · {attention} 项需关注 : null} + + 一期只对测试库;生产下架依赖测试移除 + 下一轮整库发布 +
+ ) +} + export function ReconciliationFindingsView(p: FindingsProps) { const run = p.runs.items.find((item) => item.id === p.selectedRunID) || p.runs.items[0] || null const previous = run?.previous_counts || null const pageCount = Math.max(1, Math.ceil(p.findings.total / p.findings.limit)) - const queue = p.overview?.weknora_queues return (
@@ -92,23 +123,7 @@ export function ReconciliationFindingsView(p: FindingsProps) { {p.error} ) : null} -
- - WeKnora 队列: - {queue ? ( - - {queue.queues.reduce((sum, item) => sum + item.pending, 0)} 等待 ·{' '} - {queue.queues.reduce((sum, item) => sum + item.active, 0)} 运行 - - ) : ( - 未配置只读 Key 或队列不可用 - )} - - - 服务:{p.overview?.health.filter((item) => item.readiness === 'ready').length ?? 0} 可接单 - - 一期只对测试库;生产下架依赖测试移除 + 下一轮整库发布 -
+
{loading ?

正在读取…

: null} - {error ?

{error}

: null} + {error ? ( +

+ {error} + {weknoraURL ? ( + <> + {' '} + + 在 WeKnora 中打开 + + + ) : null} +

+ ) : null} {progress ? ( <>

@@ -438,7 +473,16 @@ export function FindingDetail({ finding, onClose }: { finding: ReconciliationFin ))} - {finding.document_id ? : null} + {finding.weknora_url ? ( +

+ + 在 WeKnora 中打开 + +

+ ) : null} + {finding.document_id ? ( + + ) : null} ) } diff --git a/web/src/WeKnoraMonitor.test.tsx b/web/src/WeKnoraMonitor.test.tsx index 470b1b0..471d244 100644 --- a/web/src/WeKnoraMonitor.test.tsx +++ b/web/src/WeKnoraMonitor.test.tsx @@ -92,18 +92,21 @@ describe('unified monitor', () => { '状态说明', '共 145', '重试所选', - '服务与依赖', + 'monitor-service-strip', + 'WeKnora 队列:', ]) expect(html).toContain(s) expect(html).not.toContain('开始处理') expect(html).not.toContain('role="tab"') + expect(html).not.toContain('monitor-service-grid') expect(html).toContain('value="active" selected=""') }) it('does not claim healthy zeroes or 100% when metrics are unavailable', () => { const html = renderToStaticMarkup() expect(html).toContain('无法读取运行指标') expect(html).not.toContain('100%') - expect(html).toContain('尚未取得服务状态') + expect(html).toContain('等待运行快照') + expect(html).not.toContain('0 可接单') }) it('keeps removal semantics and does not offer retry for completed rows', () => { const html = renderToStaticMarkup() @@ -135,7 +138,7 @@ describe('target identity and probe attribution', () => { expect(html).toContain('历史') expect(html).toContain('产品/维护') }) - it('shows liveness and the sanitized probe target separately from readiness', () => { + it('surfaces a blocked service in the one-line strip without claiming readiness', () => { const overview = { mode: 'real', simulated: false, @@ -170,7 +173,7 @@ describe('target identity and probe attribution', () => { ], } const html = renderToStaticMarkup() - expect(html).toContain('存活 up') - expect(html).toContain('探测对象 实例 weknora.test · 知识库 1b52c140') + expect(html).toContain('0 可接单') + expect(html).toContain('1 项需关注') }) }) diff --git a/web/src/WeKnoraMonitor.tsx b/web/src/WeKnoraMonitor.tsx index 687002d..d711090 100644 --- a/web/src/WeKnoraMonitor.tsx +++ b/web/src/WeKnoraMonitor.tsx @@ -7,6 +7,7 @@ import { canRetryTask, actionLabels, stageLabels, + stageFilterLabels, taskStatusLabels, targetLabel, } from './monitorTasks' @@ -15,7 +16,7 @@ import { requeueJobFailure, retryPublicationsBatch, startPublicationRemoval } fr import { fetchActiveUISettings, settingsRefreshDelays } from './uiSettings' import { useOptionalAuth } from './auth' import { WorkspaceContextTabsSetter } from './workspaceContext' -import { ReconciliationFindingsView, FindingDetail, WeKnoraProgress } from './ReconciliationFindings' +import { ReconciliationFindingsView, FindingDetail, ServiceStrip, WeKnoraProgress } from './ReconciliationFindings' import type { FindingFilters } from './ReconciliationFindings' import { createReconciliationRun, @@ -196,41 +197,7 @@ export function WeKnoraMonitorView(p: ViewProps) {
-
-
-

服务与依赖

- 展开查看状态原因 -
-
- {overview?.health.length ? ( - overview.health.map((s) => ( -
- - {s.name} - - ● {healthLabel(s)} - - -

{s.reason || '未提供状态说明'}

- - 检测:{time(s.observed_at)} · {s.latency_ms} ms · 存活 {s.liveness || '未确认'} - {s.probe_target ? ` · 探测对象 ${s.probe_target}` : ''} - -
- )) - ) : ( -

尚未取得服务状态

- )} -
-
+
@@ -333,7 +300,7 @@ export function WeKnoraMonitorView(p: ViewProps) { onChange={(e) => patchFilter('stage', e.target.value)} > - {Object.entries(stageLabels).map(([key, label]) => ( + {Object.entries(stageFilterLabels).map(([key, label]) => ( diff --git a/web/src/monitorTasks.ts b/web/src/monitorTasks.ts index 95f8f98..a283858 100644 --- a/web/src/monitorTasks.ts +++ b/web/src/monitorTasks.ts @@ -74,6 +74,16 @@ export const stageLabels: Record = { removal: '测试库移除', finished: '结束', } +// 阶段筛选按需求 §8 合并「解析」「索引增强」为「WeKnora 处理中」;行内展示仍用 +// stageLabels 的细粒度阶段,两者不要互相替代。 +export const stageFilterLabels: Record = { + waiting: '等待调度', + fetch: '取件', + upload: '上传', + weknora: 'WeKnora 处理中', + removal: '测试库移除', + finished: '结束', +} export const taskStatusLabels: Record = { waiting: '等待中', running: '执行中', diff --git a/web/src/monitorWorkbench.css b/web/src/monitorWorkbench.css index 9c9471a..9b9ce53 100644 --- a/web/src/monitorWorkbench.css +++ b/web/src/monitorWorkbench.css @@ -77,25 +77,14 @@ .monitor-numbers .monitor-memory { font-size: 24px; } -.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: var(--r-lg); background: var(--bg-panel); box-shadow: var(--shadow-card); - overflow: hidden; -} -.monitor-service-panel { - padding: 18px 20px; - margin-bottom: 16px; -} -.monitor-files { /* 时间范围浮层要能溢出卡片;圆角由表头/分页各自裁切 */ overflow: visible; } @@ -125,56 +114,6 @@ 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-soft); - border-radius: var(--r-md); - background: var(--bg-soft); - padding: 10px 12px; - transition: - border-color 120ms ease, - background 120ms ease; -} -.monitor-service:hover, -.monitor-service[open] { - border-color: var(--border-base); - background: var(--bg-panel); - 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; - color: var(--ink-base); - font-weight: 500; -} -.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 20px 14px; } @@ -542,9 +481,6 @@ .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 { @@ -553,9 +489,6 @@ .monitor-heading > span { margin-left: 0; } - .monitor-service-grid { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } .monitor-metric-grid { gap: 8px; }