|
@@ -5,14 +5,14 @@
|
|
|
* `page` 0 基翻页、留存期总数 N 与命中数 M 分列下发;标注行返回空流水说明(⛔ 显 0)。
|
|
* `page` 0 基翻页、留存期总数 N 与命中数 M 分列下发;标注行返回空流水说明(⛔ 显 0)。
|
|
|
* 关键字当前只检索轮次字段(平台 R-1 `object_keyword` 未交付)⇒ `W22` 常驻。
|
|
* 关键字当前只检索轮次字段(平台 R-1 `object_keyword` 未交付)⇒ `W22` 常驻。
|
|
|
*/
|
|
*/
|
|
|
-import { useMemo, useState } from "react";
|
|
|
|
|
-import { Search, X } from "lucide-react";
|
|
|
|
|
-import { OpsDialog, OpsStatus } from "../components/OperationsKit";
|
|
|
|
|
|
|
+import { useMemo, useState, type ReactNode } from "react";
|
|
|
|
|
+import { Check, Search, X } from "lucide-react";
|
|
|
|
|
+import { OpsDialog, OpsStatus, OpsTableColumns } from "../components/OperationsKit";
|
|
|
import { Button } from "../components/ui/button";
|
|
import { Button } from "../components/ui/button";
|
|
|
import { FilterSelect } from "../components/ui/filter-select";
|
|
import { FilterSelect } from "../components/ui/filter-select";
|
|
|
import { Input } from "../components/ui/input";
|
|
import { Input } from "../components/ui/input";
|
|
|
import {
|
|
import {
|
|
|
- fmtDateTimeParts,
|
|
|
|
|
|
|
+ fmtDateTime,
|
|
|
fmtDuration,
|
|
fmtDuration,
|
|
|
last7Days,
|
|
last7Days,
|
|
|
useJobRuns,
|
|
useJobRuns,
|
|
@@ -62,6 +62,9 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
|
|
|
const state = useJobRuns(applied);
|
|
const state = useJobRuns(applied);
|
|
|
|
|
|
|
|
const jobOptions = useMemo(() => rows.filter((row) => !row.annotation), [rows]);
|
|
const jobOptions = useMemo(() => rows.filter((row) => !row.annotation), [rows]);
|
|
|
|
|
+ const recentDates = last7DaysFilter();
|
|
|
|
|
+ const recentSelected = applied.dateFrom === recentDates.dateFrom && applied.dateTo === recentDates.dateTo;
|
|
|
|
|
+ const abnormalSelected = applied.result === "异常";
|
|
|
|
|
|
|
|
const apply = (next: RunsFilter) => {
|
|
const apply = (next: RunsFilter) => {
|
|
|
setFilter(next);
|
|
setFilter(next);
|
|
@@ -121,10 +124,24 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="ops-toolbar">
|
|
<div className="ops-toolbar">
|
|
|
- <Button size="sm" type="button" variant="outline" onClick={() => apply({ ...EMPTY_RUNS_FILTER, ...last7DaysFilter() })}>
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ variant={recentSelected ? "default" : "outline"}
|
|
|
|
|
+ aria-pressed={recentSelected}
|
|
|
|
|
+ onClick={() => apply({ ...filter, ...(recentSelected ? { dateFrom: "", dateTo: "" } : recentDates) })}
|
|
|
|
|
+ >
|
|
|
|
|
+ {recentSelected && <Check size={14} aria-hidden="true" />}
|
|
|
{W21_LAST7}
|
|
{W21_LAST7}
|
|
|
</Button>
|
|
</Button>
|
|
|
- <Button size="sm" type="button" variant="outline" onClick={() => apply({ ...EMPTY_RUNS_FILTER, result: "异常" })}>
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ variant={abnormalSelected ? "default" : "outline"}
|
|
|
|
|
+ aria-pressed={abnormalSelected}
|
|
|
|
|
+ onClick={() => apply({ ...filter, result: abnormalSelected ? "" : "异常" })}
|
|
|
|
|
+ >
|
|
|
|
|
+ {abnormalSelected && <Check size={14} aria-hidden="true" />}
|
|
|
{W21_ABNORMAL}
|
|
{W21_ABNORMAL}
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|
|
@@ -142,25 +159,21 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
|
|
|
<div className="ops-empty">{RUNS_EMPTY}</div>
|
|
<div className="ops-empty">{RUNS_EMPTY}</div>
|
|
|
) : (
|
|
) : (
|
|
|
<div className="ops-list-shell">
|
|
<div className="ops-list-shell">
|
|
|
- <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>
|
|
|
|
|
|
|
+ <div className="job-runs-table">
|
|
|
|
|
+ <table className="ops-table" role="table" aria-label="执行流水">
|
|
|
|
|
+ <OpsTableColumns widths={[15, 16, 11, 17, 17, 13, 11]} />
|
|
|
|
|
+ <thead role="rowgroup">
|
|
|
|
|
+ <tr role="row">
|
|
|
|
|
+ <th scope="col">执行编号</th>
|
|
|
|
|
+ <th scope="col">任务</th>
|
|
|
|
|
+ <th scope="col">触发 / 执行人</th>
|
|
|
|
|
+ <th scope="col">执行时间</th>
|
|
|
|
|
+ <th scope="col">对象处理<small>扫描 / 命中 / 成功 / 跳过 / 失败</small></th>
|
|
|
|
|
+ <th scope="col">结果 / 处置</th>
|
|
|
|
|
+ <th scope="col">操作</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
- <tbody>
|
|
|
|
|
|
|
+ <tbody role="rowgroup">
|
|
|
{state.runs.map((run) => (
|
|
{state.runs.map((run) => (
|
|
|
<RunRow key={run.run_id} run={run} rows={rows} onDetail={() => setDetail(run)} onGoto={(page) => { onClose(); navigate(page); }} />
|
|
<RunRow key={run.run_id} run={run} rows={rows} onDetail={() => setDetail(run)} onGoto={(page) => { onClose(); navigate(page); }} />
|
|
|
))}
|
|
))}
|
|
@@ -187,36 +200,51 @@ function last7DaysFilter(): Pick<RunsFilter, "dateFrom" | "dateTo"> {
|
|
|
return { dateFrom: from, dateTo: to };
|
|
return { dateFrom: from, dateTo: to };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function RunCell({ label, children }: { label: string; children: ReactNode }) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <td role="cell">
|
|
|
|
|
+ <span className="job-run-cell-label" aria-hidden="true">{label}</span>
|
|
|
|
|
+ {children}
|
|
|
|
|
+ </td>
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function RunText({ children }: { children: string }) {
|
|
|
|
|
+ return <span className="job-run-text" title={children}>{children}</span>;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function RunRow({ run, rows, onDetail, onGoto }: { run: JobRunRow; rows: JobListRow[]; onDetail: () => void; onGoto: (page: string) => void }) {
|
|
function RunRow({ run, rows, onDetail, onGoto }: { run: JobRunRow; rows: JobListRow[]; onDetail: () => void; onGoto: (page: string) => void }) {
|
|
|
const meta = rows.find((row) => row.key === run.job_key);
|
|
const meta = rows.find((row) => row.key === run.job_key);
|
|
|
const gotoPage = run.goto_page;
|
|
const gotoPage = run.goto_page;
|
|
|
- const started = fmtDateTimeParts(run.started_at);
|
|
|
|
|
- const finished = fmtDateTimeParts(run.finished_at);
|
|
|
|
|
const executor = run.trigger === "人工" ? run.actor_user_id ?? "—" : "系统";
|
|
const executor = run.trigger === "人工" ? run.actor_user_id ?? "—" : "系统";
|
|
|
|
|
+ const duration = fmtDuration(run.started_at, run.finished_at);
|
|
|
|
|
+ const counts = [run.scanned, run.matched, run.succeeded, run.skipped, run.failed].join(" / ");
|
|
|
return (
|
|
return (
|
|
|
- <tr>
|
|
|
|
|
- <td className="ops-mono">{run.run_id}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- {run.job_name ?? meta?.displayName ?? run.job_key}
|
|
|
|
|
- <small className="ops-mono">{run.job_key}</small>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>{run.trigger || "—"}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- {started.date}
|
|
|
|
|
- <small>{started.time}</small>
|
|
|
|
|
- {finished.date && <small className="ops-import-note">完成 {finished.date} {finished.time}</small>}
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>{fmtDuration(run.started_at, run.finished_at)}</td>
|
|
|
|
|
- <td className="ops-mono">{run.scanned} / {run.matched}</td>
|
|
|
|
|
- <td className="ops-mono">{run.succeeded}</td>
|
|
|
|
|
- <td className="ops-mono">{run.skipped}</td>
|
|
|
|
|
- <td className="ops-mono">{run.failed}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <OpsStatus tone={run.status === "成功" ? "success" : run.status === "失败" ? "danger" : "warning"}>{run.status}</OpsStatus>
|
|
|
|
|
- {run.disposition_code !== "none" && <small>{run.disposition}</small>}
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>{executor}</td>
|
|
|
|
|
- <td>
|
|
|
|
|
|
|
+ <tr role="row">
|
|
|
|
|
+ <RunCell label="执行编号"><code className="ops-mono"><RunText>{run.run_id}</RunText></code></RunCell>
|
|
|
|
|
+ <RunCell label="任务">
|
|
|
|
|
+ <RunText>{run.job_name ?? meta?.displayName ?? run.job_key}</RunText>
|
|
|
|
|
+ <small className="ops-mono"><RunText>{run.job_key}</RunText></small>
|
|
|
|
|
+ </RunCell>
|
|
|
|
|
+ <RunCell label="触发 / 执行人">
|
|
|
|
|
+ <RunText>{run.trigger || "—"}</RunText>
|
|
|
|
|
+ <small><RunText>{executor}</RunText></small>
|
|
|
|
|
+ </RunCell>
|
|
|
|
|
+ <RunCell label="执行时间">
|
|
|
|
|
+ <RunText>{fmtDateTime(run.started_at)}</RunText>
|
|
|
|
|
+ {run.finished_at && <small><RunText>{`完成 ${fmtDateTime(run.finished_at)}`}</RunText></small>}
|
|
|
|
|
+ <small><RunText>{`耗时 ${duration}`}</RunText></small>
|
|
|
|
|
+ </RunCell>
|
|
|
|
|
+ <RunCell label="对象处理(扫描 / 命中 / 成功 / 跳过 / 失败)">
|
|
|
|
|
+ <code className="ops-mono"><RunText>{counts}</RunText></code>
|
|
|
|
|
+ </RunCell>
|
|
|
|
|
+ <RunCell label="结果 / 处置">
|
|
|
|
|
+ <OpsStatus tone={run.status === "成功" ? "success" : run.status === "失败" ? "danger" : "warning"}>
|
|
|
|
|
+ <RunText>{run.status}</RunText>
|
|
|
|
|
+ </OpsStatus>
|
|
|
|
|
+ {run.disposition_code !== "none" && run.disposition && <small><RunText>{run.disposition}</RunText></small>}
|
|
|
|
|
+ </RunCell>
|
|
|
|
|
+ <RunCell label="操作">
|
|
|
<div className="ops-table-actions">
|
|
<div className="ops-table-actions">
|
|
|
<button className="ops-table-action" type="button" onClick={onDetail}>
|
|
<button className="ops-table-action" type="button" onClick={onDetail}>
|
|
|
{W23_DETAIL}
|
|
{W23_DETAIL}
|
|
@@ -227,7 +255,7 @@ function RunRow({ run, rows, onDetail, onGoto }: { run: JobRunRow; rows: JobList
|
|
|
</button>
|
|
</button>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
- </td>
|
|
|
|
|
|
|
+ </RunCell>
|
|
|
</tr>
|
|
</tr>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|