mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-16 01:02:00 +00:00
数据目录 F2b:剖析报告和目录页读结构化字段,不再从原话里认——服务端最小改动:码值候选的结论带 pending(还有几个含义待填写),关系的结论带 cardinality_checked;报告里「N 个含义待填写」读 pending,基数写「已用数据核实」或「子表一侧未核实」读 cardinality_checked,挑表时跳过的空表读 empty_tables 列出来;表详情的关联关系标出基数已核实;剖析说明不带日期后,码值弹窗的说明后面按这一项的 updated_at 写时间;补后端测试和检查脚本的断言(假答复的 summary 不再写待填写)
This commit is contained in:
@@ -2541,6 +2541,12 @@ export const CATALOG_UI_TEXT = {
|
||||
publishSqlErrorBlocked: 'SQL 检查发现的错误级问题:受管级别会拦下发布,请先修改 SQL',
|
||||
publishSqlWarning: 'SQL 检查的提醒:两个发布级别都只提醒、不拦发布',
|
||||
publishSqlErrors: (n: number) => `,其中 ${formatNumber(n)} 处是 SQL 检查发现的错误级问题(受管级别会拦下)`,
|
||||
// ---- 剖析的结构化读数:基数用数据核实过没有、挑表时跳过的空表
|
||||
cardinalityChecked: '已用数据核实',
|
||||
cardinalityByStructure: '子表一侧未核实,按表结构推断',
|
||||
cardinalityCheckedShort: '已核实',
|
||||
cardinalityCheckedHint: '基数由数据剖析用数据核实(子表一侧确有重复或确实唯一),一对多关联后重复计算的检查据此报错误',
|
||||
emptyTables: (n: number) => `挑表时跳过 ${formatNumber(n)} 张空表`,
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import type { CatalogItem } from '../../types'
|
||||
import { isComposing, Modal, Spinner } from '../../components/ui'
|
||||
import { formatDateTime, formatTime } from '../../lib/format'
|
||||
import { CODES_TEXT as KT } from '../../lib/terms'
|
||||
import { StatusChip } from './parts'
|
||||
import { codesComplete } from './model'
|
||||
@@ -45,8 +46,12 @@ export function CodesDialog({ column, item, saving, onSave, onClose }: {
|
||||
<StatusChip status={item.status} source={item.source} />
|
||||
</div>
|
||||
{item.note && (
|
||||
<div className="rounded border bg-bg px-2 py-1.5 text-2xs leading-relaxed text-dim">
|
||||
<div className="rounded border bg-bg px-2 py-1.5 text-2xs leading-relaxed text-dim" data-codes-note="">
|
||||
<span className="text-faint">{KT.note}:</span>{item.note}
|
||||
{/* 说明里不带日期,时间看这一项的 updated_at(按本地时间显示) */}
|
||||
{item.updated_at && (
|
||||
<span className="tnum ml-1 text-faint" title={formatDateTime(item.updated_at)} data-codes-note-at="">({formatTime(item.updated_at)})</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="overflow-hidden rounded-lg border">
|
||||
|
||||
@@ -287,6 +287,12 @@ function Report({ report: r, ms, filled, returnTo, onSettings, onOpenTable, onFi
|
||||
</Notice>
|
||||
)}
|
||||
{r.note && <Notice tone="info" attr={{ 'data-profile-note': '' }}>{r.note}</Notice>}
|
||||
{/* 挑表途中确知是空表、跳过的表(服务端 empty_tables):一张都没剖析时 note 已经说了,这里只在剖析了别的表时列出 */}
|
||||
{r.tables.length > 0 && (r.empty_tables?.length ?? 0) > 0 && (
|
||||
<p className="text-2xs leading-relaxed text-faint" data-profile-empty-tables={r.empty_tables!.length}>
|
||||
{UT.emptyTables(r.empty_tables!.length)}:<span className="mono">{r.empty_tables!.join('、')}</span>
|
||||
</p>
|
||||
)}
|
||||
{shown.map((t) => <TableReport key={t.table_name} t={t} filled={filled} onOpenTable={onOpenTable} onFillCodes={onFillCodes} />)}
|
||||
{quiet.length > 0 && (
|
||||
<p className="text-2xs leading-relaxed text-faint" data-profile-quiet={quiet.length}>
|
||||
@@ -418,7 +424,13 @@ function RelationLine({ f }: { f: CatalogProfileRelationFinding }) {
|
||||
<div className="tnum mt-0.5 text-2xs text-dim">
|
||||
<span data-profile-coverage="">{PT.coverage(coverageText(f.coverage))}</span>
|
||||
{' · '}
|
||||
<span data-profile-cardinality="">{f.cardinality ? CATALOG_CARDINALITY_LABEL[f.cardinality] : PT.cardinalityUnknown}</span>
|
||||
<span data-profile-cardinality="" data-checked={f.cardinality ? String(!!f.cardinality_checked) : undefined}>
|
||||
{f.cardinality ? CATALOG_CARDINALITY_LABEL[f.cardinality] : PT.cardinalityUnknown}
|
||||
{/* 基数用数据核实过没有:读服务端的 cardinality_checked,不从说明的原话里认 */}
|
||||
{f.cardinality && f.cardinality_checked !== undefined && (
|
||||
<span className="text-faint">({f.cardinality_checked ? UT.cardinalityChecked : UT.cardinalityByStructure})</span>
|
||||
)}
|
||||
</span>
|
||||
{' · '}
|
||||
{PT.sampled(f.sample, f.matched)}
|
||||
</div>
|
||||
@@ -440,9 +452,8 @@ function CodesLine({ f, fillKey: key, filled, onFill }: {
|
||||
filled: number | undefined
|
||||
onFill: () => void
|
||||
}) {
|
||||
// 服务端在 summary 里写了几个含义待填写(别的来源写过的含义会沿用);认不出时按都待填写
|
||||
const reported = Number(f.summary.match(/(\d+)\s*个含义待填写/)?.[1] ?? (f.summary.includes('待填写') ? f.values.length : 0))
|
||||
const pending = filled ?? reported
|
||||
// 几个含义待填写读服务端的 pending(别的来源写过的含义会沿用),不从 summary 的原话里认;老服务端不给时不说
|
||||
const pending = filled ?? f.pending ?? 0
|
||||
const done = filled != null && filled === 0
|
||||
return (
|
||||
<li className="text-xs" data-profile-finding="codes" data-column={f.column}>
|
||||
|
||||
@@ -757,7 +757,13 @@ function RelationList({ relations, busy, targetOf, onOpen, onReview }: {
|
||||
</td>
|
||||
<td className={cell}>
|
||||
{label(CT.relationHead.cardinality)}
|
||||
{r.cardinality ? CATALOG_CARDINALITY_LABEL[r.cardinality] : <span className="text-faint">{CT.cardinalityNone}</span>}
|
||||
<span data-relation-cardinality={r.cardinality ?? ''} data-checked={r.cardinality_checked ? 'true' : undefined}>
|
||||
{r.cardinality ? CATALOG_CARDINALITY_LABEL[r.cardinality] : <span className="text-faint">{CT.cardinalityNone}</span>}
|
||||
{/* 数据剖析用数据核实过的基数(cardinality_checked):一对多关联的检查据此给「错误」,其余的最多「提醒」 */}
|
||||
{r.cardinality && r.cardinality_checked && (
|
||||
<span className="ml-1 text-2xs text-faint" title={UT.cardinalityCheckedHint}>{UT.cardinalityCheckedShort}</span>
|
||||
)}
|
||||
</span>
|
||||
</td>
|
||||
<td className={clsx('tnum', cell, typeof r.coverage !== 'number' && '@max-[40rem]:hidden')}>
|
||||
{label(CT.relationHead.coverage)}
|
||||
|
||||
@@ -2901,6 +2901,8 @@ export interface CatalogProfileRelationFinding {
|
||||
previous_status?: CatalogStatus | null
|
||||
coverage: number
|
||||
cardinality: CatalogCardinality | null
|
||||
/** 基数是不是用数据核实的(子表一侧数过是否唯一)。老服务端不给 */
|
||||
cardinality_checked?: boolean
|
||||
/** 抽了几个不同的键值、在被指向表里对上几个 */
|
||||
sample: number
|
||||
matched: number
|
||||
@@ -2915,6 +2917,8 @@ export interface CatalogProfileCodesFinding {
|
||||
values: { value: string; rows: number }[]
|
||||
rows: number
|
||||
status: CatalogStatus
|
||||
/** 写进目录的码值里还有几个含义空着(别的来源写过的含义会沿用)。老服务端不给 */
|
||||
pending?: number
|
||||
summary: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user