mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-17 14:01:58 +00:00
W4-d 收尾:队列里的任务结束时重取变化计数和清单;定时维护里不给探查任务点了没用的「查看进度」
- 目录页:后台任务条的队列里有任务走了(结束了)就重取变化的计数、「变化」视图重取一页;走的是探查任务时清单也重取(表结构 变了)。起草、剖析结束时页面跟着的任务本来就会重取清单。 - 定时维护「最近一次」:剖析任务的「查看进度」到数据目录页打开那个剖析任务(pjob);探查任务没有另外的进度页(进行中时 进度就在这张数据源卡片上),不再给一个关上对话框就什么也看不到的按钮。check-catalog-changes 补上这两条。
This commit is contained in:
@@ -222,7 +222,7 @@ export function SourceMaintenanceDialog({ source, onClose, onSaved }: {
|
||||
{schedule && <LastRun schedule={schedule} onOpenProfileJob={(id) => {
|
||||
onClose()
|
||||
navigate(`/data/catalog/${encodeURIComponent(source.id)}?pjob=${encodeURIComponent(id)}`)
|
||||
}} onClose={onClose} />}
|
||||
}} />}
|
||||
{extra > 0 && <p className="text-2xs text-faint" data-maintenance-extra={extra}>{T.extra(extra)}</p>}
|
||||
</div>
|
||||
)}
|
||||
@@ -231,8 +231,8 @@ export function SourceMaintenanceDialog({ source, onClose, onSaved }: {
|
||||
}
|
||||
|
||||
/** 已经有维护定时:下一次什么时候、最近一次建了哪些任务、哪几步没执行和原因(触发记录的 inputs),到定时任务页看全部触发 */
|
||||
function LastRun({ schedule: s, onOpenProfileJob, onClose }: {
|
||||
schedule: MaintenanceSchedule; onOpenProfileJob: (id: string) => void; onClose: () => void
|
||||
function LastRun({ schedule: s, onOpenProfileJob }: {
|
||||
schedule: MaintenanceSchedule; onOpenProfileJob: (id: string) => void
|
||||
}) {
|
||||
const fire = s.last_fire
|
||||
const inputs = fire?.inputs ?? {}
|
||||
@@ -260,10 +260,10 @@ function LastRun({ schedule: s, onOpenProfileJob, onClose }: {
|
||||
<li key={j.id} className="flex flex-wrap items-center gap-2 text-2xs" data-maintenance-job={j.id} data-maintenance-job-kind={j.kind}>
|
||||
<span className="mono">{T.lastJob(j.step.split('+').map((x) => T.step[x as MaintenanceStep] ?? x).join('、'),
|
||||
T.lastJobKind[j.kind] ?? j.kind, j.id, j.tables ?? null)}</span>
|
||||
{j.kind === 'profile'
|
||||
? <button type="button" className="btn btn-xs" onClick={() => onOpenProfileJob(j.id)} data-maintenance-job-open="">{T.viewJob}</button>
|
||||
// 探查任务的进度就在这张数据源卡片上:关上对话框就看得到
|
||||
: <button type="button" className="btn btn-xs" onClick={onClose} data-maintenance-job-open="">{T.viewJob}</button>}
|
||||
{/* 剖析任务点得进进度和结果(数据目录页的剖析对话框);探查任务进行中时进度就在这张数据源卡片上,没有另外的页面 */}
|
||||
{j.kind === 'profile' && (
|
||||
<button type="button" className="btn btn-xs" onClick={() => onOpenProfileJob(j.id)} data-maintenance-job-open="">{T.viewJob}</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -397,6 +397,19 @@ export function CatalogPage() {
|
||||
useOnReconnect(loadChangeCounts)
|
||||
const actionCount = changeCounts?.src === sourceId ? changeCounts.counts.by_severity.action : 0
|
||||
const onChangeCounts = useCallback((counts: SourceChangeCounts) => setChangeCounts({ src: sourceId, counts }), [sourceId])
|
||||
// 队列里有任务走了(结束了):探查读到了新的结构、剖析做了取值观察,都可能记下新的变化;探查改了表结构,清单也要重取
|
||||
// (起草、剖析结束时页面跟着的任务自己会重取清单)
|
||||
const queuedIds = useRef<{ src: string; ids: Map<string, string> }>({ src: '', ids: new Map() })
|
||||
useEffect(() => {
|
||||
const now = new Map(sourceJobs.items.map((i) => [i.id, i.kind]))
|
||||
const prev = queuedIds.current.src === sourceId ? queuedIds.current.ids : new Map<string, string>()
|
||||
queuedIds.current = { src: sourceId, ids: now }
|
||||
const gone = [...prev].filter(([id]) => !now.has(id)).map(([, kind]) => kind)
|
||||
if (!gone.length) return
|
||||
loadChangeCounts()
|
||||
setChangesSeq((n) => n + 1)
|
||||
if (gone.includes('introspect')) void load()
|
||||
}, [sourceJobs.items, sourceId, loadChangeCounts, load])
|
||||
|
||||
const tableProfile: TableProfileProps = useMemo(() => ({
|
||||
job: profileJob, onStart: profileTable, onShowActive: profile.showActive, onSettings: () => setProfileSettingsOpen(true),
|
||||
|
||||
Reference in New Issue
Block a user