mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-17 20:31:58 +00:00
合入集成分支(阶段 2A 数据剖析、4B 剖析与 SQL 检查界面及修正)到 4A:两边功能都保留
冲突的解法: - 后端 api/catalog.py:同时导入 catalog_impact 和 catalog_profile、SnapshotTampered;data/catalog.py:__all__ 取两边的并集重排。 - 2A 放宽了码值校验(含义可以为空,剖析写进来的是「含义待填写」):目录修改提案的码值补充改为含义为空的码不覆盖已有含义、 只在原来没有这个码时加进去,补了测试;卡片和过程里的码值把空含义写成「含义待填写」,和目录页同一个说法。 - 前端 types.ts、terms.ts:两边各在同一处追加了新段落,按顺序都留下(提案、影响面、目录版本在前,剖析、码值、SQL 检查在后), 没有重复的键;client.ts、decode.ts、CatalogPage.tsx、TableDetail.tsx 的导入取并集。 - check-catalog.mjs:影响面和剖析、保存数据源三条假路由都留下,各节和最后核对真库数量的逻辑不变。 - 4A 的测试数据源改用 tests/fixtures/sources.py 的 drop_source 删除,顺带作废连接池。
This commit is contained in:
@@ -77,9 +77,28 @@ export function revealField(nodeId: string, field?: FieldRef | string | null, op
|
||||
const to = target.querySelector<HTMLElement>(FILLABLE) ?? target.querySelector<HTMLElement>(PRESSABLE)
|
||||
to?.focus({ preventScroll: true })
|
||||
}
|
||||
// 子键没有自己的一行、字段是一段 JSON(调用工具的「参数」,问题落在 args.sql 上):在文字里找到那个键,
|
||||
// 框内滚到那一行,聚焦时光标放在它的值开头
|
||||
if (!part && at.sub) revealJsonKey(target, at.sub, !!opts.focus)
|
||||
}))
|
||||
}
|
||||
|
||||
/** JSON 文字框里的某个键:滚到它那一行;focus 时把光标放在值的开头(不选中,免得一敲键就把整段 SQL 换掉) */
|
||||
function revealJsonKey(field: HTMLElement, key: string, focus: boolean): void {
|
||||
const box = field.querySelector<HTMLTextAreaElement>('textarea')
|
||||
if (!box) return
|
||||
const m = new RegExp(`"${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"\\s*:\\s*"?`).exec(box.value)
|
||||
if (!m) return
|
||||
const line = box.value.slice(0, m.index).split('\n').length - 1
|
||||
const height = parseFloat(getComputedStyle(box).lineHeight) || 16
|
||||
box.scrollTop = Math.max(0, (line - 1) * height)
|
||||
if (focus) {
|
||||
const at = m.index + m[0].length
|
||||
box.focus({ preventScroll: true })
|
||||
box.setSelectionRange(at, at)
|
||||
}
|
||||
}
|
||||
|
||||
// 选中 → 面板开不开。放在模块级:选中可能来自别处(问题面板定位、发布弹窗、快捷键),
|
||||
// 规则只写这一份
|
||||
useStudio.subscribe((s, prev) => {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { useCatalog } from '../store/catalog'
|
||||
import { Modal, Spinner, toast, useRadioGroup } from '../components/ui'
|
||||
import { humanizeError } from '../lib/errors'
|
||||
import { PUBLISH_FIX_TEXT as T, WORKFLOW_STATUS_HINT, WORKFLOW_STATUS_LABEL } from '../lib/terms'
|
||||
import { isSqlCheckCode, sqlRuleLabel } from '../lib/sqlcheck'
|
||||
import { setLocalActor, useLocalActor } from '../lib/actor'
|
||||
import {
|
||||
autoFixIds, choiceReady, contentSig, fixFieldLabel, fixFor, fixValueLines, fixValueText, isMissingEndpoint, mergeIssues,
|
||||
@@ -42,7 +43,8 @@ export function PublishDialog({ workflow, onClose, onDone, onLocate }: {
|
||||
workflow: Workflow
|
||||
onClose: () => void
|
||||
onDone: () => void
|
||||
onLocate: (nodeId: string) => void
|
||||
/** 定位一条问题:选中节点,能落到具体配置项(调用工具的 SQL)就落到那一项 */
|
||||
onLocate: (issue: ValidationIssue) => void
|
||||
}) {
|
||||
const load = useStudio((s) => s.load)
|
||||
const dirty = useStudio((s) => s.dirty)
|
||||
@@ -208,7 +210,7 @@ export function PublishDialog({ workflow, onClose, onDone, onLocate }: {
|
||||
</dl>
|
||||
|
||||
<div className="mt-3" data-preflight="dialog">
|
||||
<Preflight pf={pf} gate={gate} onLocate={(issue) => { if (issue.node_id) { onLocate(issue.node_id); onClose() } }} />
|
||||
<Preflight pf={pf} gate={gate} onLocate={(issue) => { if (issue.node_id) { onLocate(issue); onClose() } }} />
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
@@ -564,6 +566,8 @@ function PreflightRow({ issue, others, fix, where, pf, onLocate }: {
|
||||
aria-label={err ? '错误' : '提示'} />
|
||||
<span className="min-w-0 flex-1 [overflow-wrap:anywhere]">
|
||||
{where && !String(issue.message).includes(`「${where}」`) && <b className="font-semibold">「{where}」</b>}
|
||||
{/* 对照数据目录的 SQL 检查:先写中文规则名,不露规则编号 */}
|
||||
{isSqlCheckCode(issue.code) && <span className="font-medium" data-preflight-rule="">{sqlRuleLabel(issue.code)}:</span>}
|
||||
{issue.message}
|
||||
</span>
|
||||
{issue.node_id && <CornerDownRight size={10} className="mt-px shrink-0 text-faint" aria-hidden />}
|
||||
|
||||
Reference in New Issue
Block a user