Skip to content

World's first open-source enterprise world model.

Data mapping page shows the last exploration's coverage (#662)

Royce31bb9a0829ea
diff --git a/web/src/api.ts b/web/src/api.ts
index 47df9e39..9a83bb3c 100644
--- a/web/src/api.ts
+++ b/web/src/api.ts
@@ -1554,6 +1554,23 @@ export const api = {
items: ConceptMapping[];
total: number;
counts: { proposed: number; confirmed: number; rejected: number };
+ // 最近一轮探索的账(#503)。单看列表答不了「漏了多少」——
+ // 十二条提议对着八十列的宽表与刚好覆盖完一个小库长得一样。
+ last_run?: {
+ id: string;
+ started_at: string;
+ finished_at: string | null;
+ sources: string[];
+ tables_scanned: number;
+ columns_scanned: number;
+ schema_truncated: boolean;
+ cap: number;
+ returned: number;
+ accepted: number;
+ dropped: Record<string, { n: number; example: string }>;
+ tables_covered: string[];
+ error: string | null;
+ };
}>(`/api/v1/kbs/${kbId}/mappings${qs ? `?${qs}` : ""}`);
},
/** 改一条口径。改之前那一版自动进 revisions */
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 14fccb5b..92f951a3 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -1613,6 +1613,26 @@ export const en = {
"An agent reads these schemas and proposes metric and dimension definitions. Proposals land in Pending; Ask uses them only once confirmed.",
exploreQueued:
"Exploration queued — proposals will appear under Pending. If nothing can be proposed, the alert bell will say so.",
+ // **最近一轮探索的账**——单看列表答不了「漏了多少」(#503):
+ // 十二条提议对着八十列的宽表与刚好覆盖完一个小库长得一样。这条贴出来人
+ // 才能从「等量提议」里看出覆盖范围。
+ lastRun: (r: {
+ tables: number;
+ columns: number;
+ returned: number;
+ accepted: number;
+ truncated: boolean;
+ }) => {
+ const parts = [
+ `${r.tables} tables`,
+ `${r.columns} columns`,
+ `returned ${r.returned}`,
+ `accepted ${r.accepted}`,
+ ];
+ if (r.truncated) parts.push("(schema truncated)");
+ return `Last exploration: ${parts.join(" / ")}`;
+ },
+ lastRunMissing: "No exploration has run yet.",
sourcesEmpty: "No data sources mounted.",
sourcesNoneAvailable:
"No data sources registered yet — ask a deployment admin to register one.",
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index d255560d..117a2ea1 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -1406,6 +1406,26 @@ export const zh: Strings = {
exploreHint:
"一个智能体读这些库表结构,提出指标/维度的口径。提出来的落在「待审批」,确认之后问数才会用。",
exploreQueued: "探索已排队,提议会出现在「待确认」里;一条都提不出来时,铃铛会告诉你。",
+ // **最近一轮探索的账**——光看列表答不了「漏了多少」(#503):
+ // 十二条提议对着八十列的宽表与刚好覆盖完一个小库长得一样。这条贴出来人
+ // 才能从「等量提议」里看出覆盖范围。
+ lastRun: (r: {
+ tables: number;
+ columns: number;
+ returned: number;
+ accepted: number;
+ truncated: boolean;
+ }) => {
+ const parts = [
+ `${r.tables} 张表`,
+ `${r.columns} 列`,
+ `返回 ${r.returned}`,
+ `落库 ${r.accepted}`,
+ ];
+ if (r.truncated) parts.push("(结构被截)");
+ return `上一轮探索:${parts.join(" / ")}`;
+ },
+ lastRunMissing: "还没有跑过探索。",
sourcesEmpty: "没有挂载任何数据源。",
sourcesNoneAvailable: "还没有登记数据源——请部署管理员登记一个。",
newConn: "登记新连接",
diff --git a/web/src/pages/Mappings.tsx b/web/src/pages/Mappings.tsx
index 45883285..90496b19 100644
--- a/web/src/pages/Mappings.tsx
+++ b/web/src/pages/Mappings.tsx
@@ -261,6 +261,23 @@ export function Mappings() {
{status === "rejected" && (
<p className="text-small text-ink-2">{S.mapping.rejectedHint}</p>
)}
+ {/* 最近一轮探索的账(#503)。**单看列表答不了「漏了多少」**——十二条
+ 提议对着八十列的宽表与刚好覆盖完一个小库长得一样。这条贴出来人才能
+ 从「等量提议」里看出覆盖范围。filtered out of view 反而更糟:搜索框
+ 在搜索的时候人最容易忘上一次跑了多深 */}
+ {data.data?.last_run ? (
+ <p className="text-small text-ink-2">
+ {S.mapping.lastRun({
+ tables: data.data.last_run.tables_scanned,
+ columns: data.data.last_run.columns_scanned,
+ returned: data.data.last_run.returned,
+ accepted: data.data.last_run.accepted,
+ truncated: data.data.last_run.schema_truncated,
+ })}
+ </p>
+ ) : (
+ <p className="text-small text-ink-2">{S.mapping.lastRunMissing}</p>
+ )}
{data.isPending ? (
<Loading>{S.nav.loading}</Loading>