|
|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * 册10 SC-03 执行记录抽屉+轮次弹窗。
|
|
|
+ * 册10 SC-03 执行记录与轮次详情。
|
|
|
* 契约:docs/.../10-第10册-定时任务与审计视图/14-页面契约本册逐页.md §14.2、作业§4.4/§4.5。
|
|
|
* 接线现状:`/jobs/runs@v1` [实]——五件筛选(关键字/任务/触发方式/结果/日期区间)、
|
|
|
* `page` 0 基翻页、留存期总数 N 与命中数 M 分列下发;标注行返回空流水说明(⛔ 显 0)。
|
|
|
@@ -7,7 +7,7 @@
|
|
|
*/
|
|
|
import { useMemo, useState } from "react";
|
|
|
import { Search, X } from "lucide-react";
|
|
|
-import { OpsDrawer, OpsStatus } from "../components/OperationsKit";
|
|
|
+import { OpsDialog, OpsStatus } from "../components/OperationsKit";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
import { FilterSelect } from "../components/ui/filter-select";
|
|
|
import { Input } from "../components/ui/input";
|
|
|
@@ -49,15 +49,15 @@ import {
|
|
|
import type { JobRunRow } from "../lib/api/types";
|
|
|
import { useNavigate } from "react-router";
|
|
|
|
|
|
-export interface DrawerPreset {
|
|
|
+export interface JobRunsPreset {
|
|
|
jobKey: string;
|
|
|
jobName: string;
|
|
|
}
|
|
|
|
|
|
-export function JobRunsDrawer({ preset, rows, onClose }: { preset: DrawerPreset | null; rows: JobListRow[]; onClose: () => void }) {
|
|
|
+export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset; rows: JobListRow[]; onClose: () => void }) {
|
|
|
const navigate = useNavigate();
|
|
|
- const [filter, setFilter] = useState<RunsFilter>({ ...EMPTY_RUNS_FILTER, jobKey: preset?.jobKey ?? "" });
|
|
|
- const [applied, setApplied] = useState<RunsFilter>({ ...EMPTY_RUNS_FILTER, jobKey: preset?.jobKey ?? "" });
|
|
|
+ const [filter, setFilter] = useState<RunsFilter>({ ...EMPTY_RUNS_FILTER, jobKey: preset.jobKey });
|
|
|
+ const [applied, setApplied] = useState<RunsFilter>({ ...EMPTY_RUNS_FILTER, jobKey: preset.jobKey });
|
|
|
const [detail, setDetail] = useState<JobRunRow | null>(null);
|
|
|
const state = useJobRuns(applied);
|
|
|
|
|
|
@@ -68,13 +68,13 @@ export function JobRunsDrawer({ preset, rows, onClose }: { preset: DrawerPreset
|
|
|
setApplied(next);
|
|
|
};
|
|
|
|
|
|
- // 抽屉标题=W16(N=服务端留存期总数,M=当前已装载轮次)
|
|
|
+ // W16:N 为服务端留存期总数,M 为当前已装载轮次。
|
|
|
const title = w16(state.retentionTotal === null ? "—" : String(state.retentionTotal), state.runs.length);
|
|
|
|
|
|
return (
|
|
|
- <OpsDrawer title={title} subtitle="按轮次查看执行流水" wide onClose={onClose}>
|
|
|
- <div className="ops-drawer-body">
|
|
|
- {preset && <p className="ops-import-note">{w17(preset.jobName)}</p>}
|
|
|
+ <OpsDialog title={title} subtitle="按轮次查看执行流水" className="job-runs-dialog" onClose={onClose}>
|
|
|
+ <div className="job-runs-body">
|
|
|
+ <p className="ops-import-note">{w17(preset.jobName)}</p>
|
|
|
<div className="ops-toolbar scheduled-jobs-filters">
|
|
|
<label className="ops-search">
|
|
|
<Search size={16} />
|
|
|
@@ -142,29 +142,31 @@ export function JobRunsDrawer({ preset, rows, onClose }: { preset: DrawerPreset
|
|
|
<div className="ops-empty">{RUNS_EMPTY}</div>
|
|
|
) : (
|
|
|
<div className="ops-list-shell">
|
|
|
- <table className="ops-table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>执行编号</th>
|
|
|
- <th>任务</th>
|
|
|
- <th>触发方式</th>
|
|
|
- <th>开始时间</th>
|
|
|
- <th>耗时</th>
|
|
|
- <th>扫描/命中</th>
|
|
|
- <th>成功</th>
|
|
|
- <th>跳过</th>
|
|
|
- <th>失败</th>
|
|
|
- <th>结果/处置</th>
|
|
|
- <th>执行人</th>
|
|
|
- <th>操作</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- {state.runs.map((run) => (
|
|
|
- <RunRow key={run.run_id} run={run} rows={rows} onDetail={() => setDetail(run)} onGoto={(page) => { onClose(); navigate(page); }} />
|
|
|
- ))}
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <div className="job-runs-table" role="region" aria-label="执行流水,可横向滚动" tabIndex={0}>
|
|
|
+ <table className="ops-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>执行编号</th>
|
|
|
+ <th>任务</th>
|
|
|
+ <th>触发方式</th>
|
|
|
+ <th>开始时间</th>
|
|
|
+ <th>耗时</th>
|
|
|
+ <th>扫描/命中</th>
|
|
|
+ <th>成功</th>
|
|
|
+ <th>跳过</th>
|
|
|
+ <th>失败</th>
|
|
|
+ <th>结果/处置</th>
|
|
|
+ <th>执行人</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {state.runs.map((run) => (
|
|
|
+ <RunRow key={run.run_id} run={run} rows={rows} onDetail={() => setDetail(run)} onGoto={(page) => { onClose(); navigate(page); }} />
|
|
|
+ ))}
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
{state.hasMore && (
|
|
|
<div className="ops-toolbar" style={{ justifyContent: "center" }}>
|
|
|
<Button size="sm" type="button" variant="outline" disabled={state.loadingMore} onClick={state.loadMore}>
|
|
|
@@ -176,7 +178,7 @@ export function JobRunsDrawer({ preset, rows, onClose }: { preset: DrawerPreset
|
|
|
)}
|
|
|
</div>
|
|
|
{detail && <RoundDialog run={detail} rows={rows} onClose={() => setDetail(null)} />}
|
|
|
- </OpsDrawer>
|
|
|
+ </OpsDialog>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -237,9 +239,8 @@ function RoundDialog({ run, rows, onClose }: { run: JobRunRow; rows: JobListRow[
|
|
|
const detail = run.detail ?? [];
|
|
|
const violations = run.violations ?? [];
|
|
|
return (
|
|
|
- <div className="ops-confirm-backdrop" role="presentation" onMouseDown={onClose}>
|
|
|
- <div className="ops-confirm ops-round-dialog" role="dialog" aria-modal="true" aria-labelledby="round-title" onMouseDown={(event) => event.stopPropagation()}>
|
|
|
- <h2 id="round-title">{w26(run.run_id)}</h2>
|
|
|
+ <OpsDialog title={w26(run.run_id)} className="job-round-dialog" onClose={onClose}>
|
|
|
+ <div className="job-runs-body">
|
|
|
<p className="ops-import-note">
|
|
|
{run.job_name ?? meta?.displayName ?? run.job_key}
|
|
|
{interrupted ? W28 : W27}
|
|
|
@@ -258,7 +259,7 @@ function RoundDialog({ run, rows, onClose }: { run: JobRunRow; rows: JobListRow[
|
|
|
{detail.length === 0 ? (
|
|
|
<p className="ops-import-note">{ROUND_DETAIL_EMPTY}</p>
|
|
|
) : (
|
|
|
- <div className="ops-list-shell" style={{ maxHeight: 260, overflow: "auto" }}>
|
|
|
+ <div className="ops-list-shell job-round-table" role="region" aria-label="轮次对象明细,可滚动" tabIndex={0}>
|
|
|
<table className="ops-table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
@@ -294,12 +295,12 @@ function RoundDialog({ run, rows, onClose }: { run: JobRunRow; rows: JobListRow[
|
|
|
</ul>
|
|
|
</>
|
|
|
)}
|
|
|
- <div>
|
|
|
+ <footer className="job-round-actions">
|
|
|
<Button type="button" variant="outline" onClick={onClose}>
|
|
|
关闭
|
|
|
</Button>
|
|
|
- </div>
|
|
|
+ </footer>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </OpsDialog>
|
|
|
);
|
|
|
}
|