| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- /**
- * 册10 SC-01/SC-02 任务清单页(路由 /daily-tasks,契约路由 /bos/job/list)。
- * 契约:docs/.../10-第10册-定时任务与审计视图/14-页面契约本册逐页.md §14.1、作业§3。
- * 接线状态:
- * - 行集=`/jobs/get_list@v1` 真实下发(13 行=注册位 11 +标注行 2);
- * - 主表只呈现业务组 9 行;系统维护组 4 行移入标题栏右侧「系统维护任务」弹窗(2026-11-15 页面分区调整),
- * 避免业务用户把系统维护任务与业务任务混淆;分组、可操作性位与统计口径不变;
- * - 状态列、可操作性位、五格计数、最近执行与累计轮次均由服务端兜底调度器实时聚合;
- * - KPI 五卡与页顶告警条同源同数(`kpi`/`pending_reruns`)。
- */
- import { useMemo, useState } from "react";
- import { PageIntro } from "../components/PageIntro";
- import { CalendarClock, ChevronDown, History, Info, TriangleAlert, Wrench, X } from "lucide-react";
- import { Button } from "../components/ui/button";
- import { OpsDialog, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
- import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
- import { useDemoIdentity } from "../lib/demo-session";
- import {
- fmtDateTime,
- fmtDateTimeParts,
- fmtDurationMs,
- submitJobToggle,
- useJobCenter,
- type JobListRow,
- } from "../lib/scheduled-jobs";
- import {
- ANNOTATION_SUBMIT,
- BTN_CANCEL,
- BTN_CONFIRM_DISABLE,
- BTN_CONFIRM_ENABLE,
- CONFIRM_DISABLE_TITLE,
- CONFIRM_ENABLE_TITLE,
- KPI_ABNORMAL_TODAY,
- KPI_OBJECTS_TODAY,
- KPI_PENDING_RERUN,
- KPI_RUNS_TODAY,
- MAINT_CLOSE,
- MAINT_DIALOG_TITLE,
- MAINT_TRIGGER,
- NEVER_RUN,
- PLAN_DISABLED,
- PLAN_NOT_WIRED,
- RUNTIME_PENDING,
- STATE_DISABLED,
- STATE_ENABLED,
- STATE_NOT_WIRED,
- STATE_NO_SWITCH,
- W1,
- W2P,
- W2PP,
- W4,
- W5,
- W6,
- W7,
- W7P_DISABLED,
- W7P_LOCAL,
- W7P_PLATFORM,
- W8,
- W20,
- W23_DETAIL,
- W23_DISABLE,
- W23_ENABLE,
- W23_RUNS,
- W23_VIEW_RUNS,
- W25,
- maintSubtitle,
- w24,
- w9,
- } from "../lib/copy-jobs";
- import { JobRunsDialog, type JobRunsPreset } from "./JobRunsDialog";
- import { ListPager } from "../components/ListPager";
- import { slicePage, useLocalPage } from "../lib/list-paging";
- import "../styles/operations.css";
- import "../styles/scheduled-jobs.css";
- /* ── 单元格渲染 ────────────────────────────────────────────────── */
- function RuntimePendingCell() {
- return (
- <span className="job-cell-pending">
- —<small>{RUNTIME_PENDING}</small>
- </span>
- );
- }
- /** 任务状态由服务端决定。 */
- function StateCell({ row }: { row: JobListRow }) {
- if (row.annotation) return <OpsStatus tone="neutral">{STATE_NO_SWITCH}</OpsStatus>;
- if (!row.wired) return <OpsStatus tone="warning">{STATE_NOT_WIRED}</OpsStatus>;
- if (row.enabled === true) return <OpsStatus tone="success">{STATE_ENABLED}</OpsStatus>;
- if (row.enabled === false) return <OpsStatus tone="neutral">{STATE_DISABLED}</OpsStatus>;
- // 后端取数失败 ⇒ 诚实「未取到」,⛔ 猜启用态
- return <RuntimePendingCell />;
- }
- /** 启停权限由服务端返回的 toggleable 和 reason_code 决定。 */
- function ToggleCell({ row, isAdmin, onToggle }: { row: JobListRow; isAdmin: boolean; onToggle: (row: JobListRow, enable: boolean) => void }) {
- if (row.annotation) return null; // 格⑤:无操作标记
- if (row.reasonCode === "NOT_WIRED") return <small className="job-cell-note">{W5}</small>;
- if (row.toggleable === true && isAdmin) {
- const enabled = row.enabled === true;
- return (
- <button className={enabled ? "ops-table-action job-toggle-danger" : "ops-table-action"} type="button" aria-haspopup="dialog" onClick={() => onToggle(row, !enabled)}>
- {enabled ? W23_DISABLE : W23_ENABLE}
- </button>
- );
- }
- if (row.reasonCode === "ROLE_READONLY") return <small className="job-cell-note">{W6}</small>;
- if (row.toggleable === false && row.reasonCode === "NO_SWITCH") return null; // 无开关 ⇒ 无操作标记
- if (!isAdmin && row.wired) return <small className="job-cell-note">{W6}</small>;
- if (row.toggleable === false) return <small className="job-cell-note">{W5}</small>;
- // 运行态未取到:不渲启停位(总则§16.9)
- return null;
- }
- /* ── 启停确认弹窗(SC-02) ────────────────────────────────────────── */
- function ToggleConfirmDialog({
- row,
- enable,
- onCancel,
- onDone,
- }: {
- row: JobListRow;
- enable: boolean;
- onCancel: () => void;
- onDone: (message: string, refresh: boolean) => void;
- }) {
- const [pending, setPending] = useState(false);
- const [error, setError] = useState<string | null>(null);
- const name = row.displayName;
- const schedule = row.cronHint || row.meta?.scheduleText || "";
- const submit = async () => {
- setPending(true);
- setError(null);
- const outcome = await submitJobToggle(row, enable);
- setPending(false);
- if (outcome.kind === "error") {
- setError(outcome.message); // 失败:弹窗保持,⛔ 关窗吞错
- return;
- }
- onDone(outcome.message, true); // 成功/部分成功/并发:统一重拉清单(并发态恒 W12+刷新)
- };
- return (
- <div className="ops-confirm-backdrop" role="presentation" onMouseDown={onCancel}>
- <div className="ops-confirm" role="dialog" aria-modal="true" aria-labelledby="job-toggle-title" onMouseDown={(event) => event.stopPropagation()}>
- <h2 id="job-toggle-title">{enable ? CONFIRM_ENABLE_TITLE(name) : CONFIRM_DISABLE_TITLE(name)}</h2>
- <p>
- {enable ? w9(schedule) : W8}
- {!enable && row.stopImpactNote ? ` ${row.stopImpactNote}` : ""}
- </p>
- {error && (
- <p className="ops-form-error" role="alert">
- {error}
- </p>
- )}
- <div>
- <Button type="button" variant="ghost" disabled={pending} onClick={onCancel}>
- {BTN_CANCEL}
- </Button>
- <Button type="button" disabled={pending} onClick={submit}>
- {pending ? "提交中…" : enable ? BTN_CONFIRM_ENABLE : BTN_CONFIRM_DISABLE}
- </Button>
- </div>
- </div>
- </div>
- );
- }
- function RunStatus({ row }: { row: JobListRow }) {
- return <OpsStatus tone={row.lastStatusTone === "success" ? "success" : row.lastStatusTone === "failed" ? "danger" : "warning"}>{row.lastStatus}</OpsStatus>;
- }
- /* ── 作业定义弹窗 ────────────────────────────────────────────────── */
- function JobDefinitionDialog({ row, onClose, onViewRuns }: { row: JobListRow; onClose: () => void; onViewRuns: () => void }) {
- const planText = row.annotation
- ? "—"
- : !row.wired
- ? PLAN_NOT_WIRED
- : row.enabled === false
- ? PLAN_DISABLED
- : row.enabled === true
- ? row.cronHint
- : "—";
- return (
- <OpsDialog title={row.displayName} subtitle={w24(row.key)} className="job-definition-dialog" onClose={onClose}>
- <div className="job-definition-body">
- <dl className="job-definition-overview">
- <div>
- <dt>当前状态</dt>
- <dd><StateCell row={row} /></dd>
- </div>
- <div>
- <dt>累计执行轮次</dt>
- <dd className="job-definition-total">{row.runCount?.toLocaleString("zh-CN") ?? "—"}</dd>
- </div>
- <div>
- <dt>最近一次执行</dt>
- <dd className="job-definition-latest">
- {row.lastRunAt ? (
- <>
- <time dateTime={row.lastRunAt}>{fmtDateTime(row.lastRunAt)}</time>
- {row.lastStatus && <RunStatus row={row} />}
- </>
- ) : row.annotation ? "不适用" : NEVER_RUN}
- </dd>
- </div>
- </dl>
- <div className="job-definition-sections">
- <section className="job-definition-panel">
- <h3>调度配置</h3>
- <dl>
- <div><dt>任务名称(注册契约)</dt><dd>{row.registryName}</dd></div>
- <div><dt>触发方式</dt><dd>{row.triggerText}</dd></div>
- <div><dt>调度时点</dt><dd>{row.annotation ? ANNOTATION_SUBMIT : row.cronHint}</dd></div>
- <div><dt>下轮计划</dt><dd>{planText}</dd></div>
- </dl>
- </section>
- <section className="job-definition-panel">
- <h3>执行规则</h3>
- <dl>
- <div><dt>处理对象</dt><dd>{row.objectScope ?? "—"}</dd></div>
- <div><dt>执行动作</dt><dd>{row.actionText ?? "—"}</dd></div>
- <div><dt>幂等口径</dt><dd>{row.idempotencyText ?? "—"}</dd></div>
- </dl>
- </section>
- </div>
- <p className="job-definition-note">{W25}</p>
- </div>
- <footer className="job-definition-footer">
- <Button type="button" variant="outline" onClick={onClose}>关闭</Button>
- <Button type="button" onClick={onViewRuns}><History size={16} aria-hidden="true" />{W23_VIEW_RUNS}</Button>
- </footer>
- </OpsDialog>
- );
- }
- /* ── 系统维护任务弹窗(2026-11-15:系统维护组不进主表,改由标题栏右侧图标进入) ── */
- function MaintRow({
- row,
- isAdmin,
- onDetail,
- onRuns,
- onToggle,
- }: {
- row: JobListRow;
- isAdmin: boolean;
- onDetail: (row: JobListRow) => void;
- onRuns: (row: JobListRow) => void;
- onToggle: (row: JobListRow, enable: boolean) => void;
- }) {
- const parts = row.lastRunAt ? fmtDateTimeParts(row.lastRunAt) : null;
- return (
- <tr>
- <td className="ops-mono">{row.key}</td>
- <td>
- <span className="table-cell-title">{row.displayName}</span>
- </td>
- <td>
- <span>{row.cronHint}</span>
- <small>{row.triggerText}</small>
- </td>
- <td>
- {parts ? (
- <span className="ops-mono">
- {parts.date} {parts.time}
- </span>
- ) : (
- NEVER_RUN
- )}
- </td>
- <td>
- <StateCell row={row} />
- </td>
- <td>
- <div className="ops-table-actions">
- <button className="ops-table-action" type="button" onClick={() => onDetail(row)}>
- <Info size={14} /> {W23_DETAIL}
- </button>
- <button className="ops-table-action" type="button" onClick={() => onRuns(row)}>
- <History size={14} /> {W23_RUNS}
- </button>
- <ToggleCell row={row} isAdmin={isAdmin} onToggle={onToggle} />
- </div>
- </td>
- </tr>
- );
- }
- function SystemJobsDialog({
- rows,
- isAdmin,
- onClose,
- onDetail,
- onRuns,
- onToggle,
- }: {
- rows: JobListRow[];
- isAdmin: boolean;
- onClose: () => void;
- onDetail: (row: JobListRow) => void;
- onRuns: (row: JobListRow) => void;
- onToggle: (row: JobListRow, enable: boolean) => void;
- }) {
- const enabled = rows.filter((row) => row.enabled === true).length;
- return (
- <div className="ops-confirm-backdrop" role="presentation" onMouseDown={onClose}>
- <div
- className="ops-confirm ops-maint-dialog"
- role="dialog"
- aria-modal="true"
- aria-labelledby="maint-title"
- onMouseDown={(event) => event.stopPropagation()}
- >
- <div className="ops-maint-head">
- <div>
- <h2 id="maint-title">{MAINT_DIALOG_TITLE}</h2>
- <p className="ops-maint-meta">{maintSubtitle(rows.length, enabled)}</p>
- </div>
- <button className="ops-maint-close" type="button" aria-label={MAINT_CLOSE} onClick={onClose}>
- <X size={16} />
- </button>
- </div>
- {/* W2″:原为页顶第三句横幅;系统维护组离开主表后,该说明随组进入本弹窗 */}
- <p className="ops-import-note ops-maint-note">{W2PP}</p>
- <div className="ops-maint-body">
- <table className="ops-maint-table">
- <thead>
- <tr>
- <th>任务编码</th>
- <th>任务名称</th>
- <th>调度与触发</th>
- <th>上次执行</th>
- <th>状态</th>
- <th className="ops-maint-actions-head">操作</th>
- </tr>
- </thead>
- <tbody>
- {rows.map((row) => (
- <MaintRow
- key={row.key}
- row={row}
- isAdmin={isAdmin}
- onDetail={onDetail}
- onRuns={onRuns}
- onToggle={onToggle}
- />
- ))}
- </tbody>
- </table>
- </div>
- <div className="ops-maint-foot">
- <Button type="button" variant="ghost" onClick={onClose}>
- {MAINT_CLOSE}
- </Button>
- </div>
- </div>
- </div>
- );
- }
- /* ── 页面本体 ─────────────────────────────────────────────────────── */
- export function ScheduledJobManagementPage() {
- const identity = useDemoIdentity();
- const isAdmin = identity?.role === "admin";
- const center = useJobCenter();
- const [notice, setNotice] = useState<string | null>(null);
- const [toggleTarget, setToggleTarget] = useState<{ row: JobListRow; enable: boolean } | null>(null);
- const [defRow, setDefRow] = useState<JobListRow | null>(null);
- const [runsPreset, setRunsPreset] = useState<JobRunsPreset | null>(null);
- const [maintOpen, setMaintOpen] = useState(false);
- const scroll = useHorizontalOverflow();
- // 2026-11-15:系统维护组不再进主表(避免与业务任务混淆),改由标题栏右侧入口弹窗查看。
- const businessRows = useMemo(() => center.rows.filter((row) => row.group === "business"), [center.rows]);
- const systemRows = useMemo(() => center.rows.filter((row) => row.group === "system"), [center.rows]);
- const hasAnnotation = center.rows.some((row) => row.annotation);
- // 分页只覆盖主表(业务组);系统维护组走弹窗,不参与分页与「共 N 行」。
- const paging = useLocalPage(businessRows.length);
- const pageRows = slicePage(businessRows, paging.safePage);
- const openRuns = (row: JobListRow) => {
- setMaintOpen(false);
- setRunsPreset({ jobKey: row.key, jobName: row.displayName });
- };
- const widths = [18, 15, 12, 12, 14, 10, 19];
- const { kpi, scheduler } = center;
- const schedulerLabel = scheduler?.source === "platform" ? "平台调度" : scheduler?.source === "local" ? "进程内调度" : "调度已关闭";
- const schedulerNote = scheduler?.source === "platform" ? W7P_PLATFORM : scheduler?.source === "local" ? W7P_LOCAL : W7P_DISABLED;
- const metrics = [
- {
- title: "启用/全部",
- value: kpi?.tasks_enabled ?? "—",
- total: kpi?.tasks_enabled == null ? undefined : kpi.tasks_total,
- icon: CalendarClock,
- note: kpi ? `系统维护任务 ${kpi.system_enabled ?? "—"} / ${kpi.system_total},单独统计` : undefined,
- },
- { title: KPI_RUNS_TODAY, value: kpi?.runs_today ?? "—" },
- { title: KPI_OBJECTS_TODAY, value: kpi?.objects_today ?? "—" },
- { title: KPI_ABNORMAL_TODAY, value: kpi?.abnormal_today ?? "—", attention: (kpi?.abnormal_today ?? 0) > 0 },
- { title: KPI_PENDING_RERUN, value: kpi?.pending_rerun ?? "—", attention: (kpi?.pending_rerun ?? 0) > 0 },
- ];
- const renderRow = (row: JobListRow) => {
- const lastRun = fmtDateTimeParts(row.lastRunAt);
- const counts = row.lastCounts;
- return (
- <tr key={row.key}>
- <td>
- <span className="table-cell-title">{row.displayName}</span>
- <code className="ops-mono">{row.key}</code>
- </td>
- <td>
- {row.annotation ? <span className="job-ledger-trigger">{ANNOTATION_SUBMIT}</span> : (
- <>
- <span className="job-ledger-trigger">{row.cronHint}</span>
- <small>{row.triggerText}</small>
- </>
- )}
- </td>
- <td>
- {row.annotation ? "—" : row.lastRunAt ? (
- <>
- <time dateTime={row.lastRunAt} className="job-ledger-time">{lastRun.date} {lastRun.time}</time>
- <small>耗时 {fmtDurationMs(row.lastDurationMs)}</small>
- </>
- ) : NEVER_RUN}
- </td>
- <td>{row.lastStatus && !row.annotation ? <RunStatus row={row} /> : "—"}</td>
- <td>
- {row.annotation ? "—" : counts ? (
- <span className="job-ledger-counts ops-mono table-number">
- {counts.scanned}{" / "}{counts.matched}{" / "}{counts.succeeded}{" / "}{counts.skipped}{" / "}
- <span className={counts.failed > 0 ? "is-failed" : undefined}>{counts.failed}</span>
- </span>
- ) : <RuntimePendingCell />}
- </td>
- <td><StateCell row={row} /></td>
- <td>
- <div className="ops-table-actions job-ledger-actions">
- <button className="ops-table-action job-ledger-history" type="button" aria-haspopup="dialog" onClick={() => openRuns(row)}>
- <History size={14} /> {W23_RUNS}
- </button>
- <button className="ops-table-action" type="button" aria-haspopup="dialog" onClick={() => setDefRow(row)}>{W23_DETAIL}</button>
- <ToggleCell row={row} isAdmin={isAdmin} onToggle={(target, enable) => setToggleTarget({ row: target, enable })} />
- </div>
- </td>
- </tr>
- );
- };
- return (
- <section className="ops-page scheduled-jobs-page">
- <header className="ops-heading scheduled-jobs-head">
- <div>
- <h1>定时任务</h1>
- <PageIntro>跟踪后台作业的调度与执行,发现异常后可回查每轮记录。</PageIntro>
- </div>
- {systemRows.length > 0 && (
- <button
- className="scheduled-jobs-maint-trigger"
- type="button"
- aria-haspopup="dialog"
- aria-label={`${MAINT_TRIGGER}(共 ${systemRows.length} 个)`}
- onClick={() => setMaintOpen(true)}
- >
- <Wrench size={16} aria-hidden="true" />
- <span>{MAINT_TRIGGER}</span>
- <span className="scheduled-jobs-maint-count">{systemRows.length}</span>
- </button>
- )}
- </header>
- <section className="scheduled-jobs-overview" aria-label="运行概览">
- <dl className="scheduled-jobs-metrics">
- {metrics.map(({ title, value, total, icon: Icon, note, attention }) => (
- <div className={Icon ? "scheduled-jobs-metric scheduled-jobs-metric--lead" : "scheduled-jobs-metric"} key={title}>
- <dt>
- {Icon && <span className="scheduled-jobs-metric-icon"><Icon size={21} aria-hidden="true" /></span>}
- {title}
- </dt>
- <dd className={center.runtimeAvailable && attention ? "is-attention" : undefined}>
- {center.runtimeAvailable ? (typeof value === "number" ? value.toLocaleString("zh-CN") : value) : "—"}
- {center.runtimeAvailable && total !== undefined && <small> / {total.toLocaleString("zh-CN")}</small>}
- </dd>
- {center.runtimeAvailable && note && <dd className="scheduled-jobs-metric-note">{note}</dd>}
- </div>
- ))}
- </dl>
- {!center.runtimeAvailable && !center.loading && !center.error && (
- <p className="scheduled-jobs-runtime-note" role="status">{W7}{center.runtimeError ? ` · ${center.runtimeError}` : ""}</p>
- )}
- </section>
- {center.pendingReruns.length > 0 && (
- <details className="scheduled-jobs-reruns">
- <summary>
- <TriangleAlert size={17} aria-hidden="true" />
- <strong>待人工补跑</strong>
- <span>{center.pendingReruns.length} 轮</span>
- <ChevronDown size={16} aria-hidden="true" />
- </summary>
- <ul>
- {center.pendingReruns.map((run) => {
- const row = center.rows.find((job) => job.key === run.job_key);
- return (
- <li key={run.run_id}>
- <span><strong>{run.job_name}</strong><small>{fmtDateTime(run.started_at)} · {run.run_id}</small></span>
- {row && <button className="ops-table-action" type="button" aria-haspopup="dialog" onClick={() => openRuns(row)}>{W23_RUNS}</button>}
- </li>
- );
- })}
- </ul>
- </details>
- )}
- <section className="ops-list-shell scheduled-jobs-panel" aria-label="业务任务">
- {center.error && (
- <div className="scheduled-jobs-load-error" role="alert">
- <p>{W20}:{center.error}</p>
- <Button size="sm" type="button" variant="outline" onClick={center.reload}>重试</Button>
- </div>
- )}
- <div
- ref={scroll.ref}
- className={scroll.overflow ? "measured-table-scroll ops-table-wrap has-horizontal-overflow" : "measured-table-scroll ops-table-wrap"}
- role="region"
- aria-label="业务任务清单,可横向滚动查看"
- tabIndex={0}
- >
- <table className="ops-table job-ledger">
- <OpsTableColumns widths={widths} />
- <thead>
- <tr>
- <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>
- </thead>
- <tbody>
- {pageRows.map(renderRow)}
- {center.loading && <OpsTableEmpty colSpan={7}>正在加载…</OpsTableEmpty>}
- {!center.loading && businessRows.length === 0 && !center.error && (
- <OpsTableEmpty colSpan={7}>调度平台注册位为空。</OpsTableEmpty>
- )}
- </tbody>
- </table>
- </div>
- {scroll.overflow && <p className="scheduled-jobs-scroll-hint">横向滚动查看全部字段</p>}
- <ListPager total={businessRows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} unit="项" className="list-pager" />
- </section>
- <details className="scheduled-jobs-notes">
- <summary>
- 调度说明
- {scheduler && <span className="scheduled-jobs-source" data-scheduler-source={scheduler.source}>{schedulerLabel}</span>}
- {center.missingRegistryKeys.length > 0 && " · 注册表有缺位"}
- <ChevronDown size={15} aria-hidden="true" />
- </summary>
- <ul>
- {scheduler && <li>{schedulerNote}{scheduler.source === "platform" && scheduler.cmd_topic ? `(命令通道 ${scheduler.cmd_topic})` : ""}</li>}
- <li>{W1}</li>
- {hasAnnotation && <li>{W2P}</li>}
- <li>{W4}</li>
- {center.missingRegistryKeys.length > 0 && <li>后端注册表缺位:{center.missingRegistryKeys.join("、")}</li>}
- </ul>
- </details>
- {/* 系统维护任务弹窗(标题栏右侧入口);确认/定义弹窗在其后渲染,同层叠顺序下覆盖其上 */}
- {maintOpen && systemRows.length > 0 && (
- <SystemJobsDialog
- rows={systemRows}
- isAdmin={isAdmin}
- onClose={() => setMaintOpen(false)}
- onDetail={(row) => setDefRow(row)}
- onRuns={openRuns}
- onToggle={(target, enable) => setToggleTarget({ row: target, enable })}
- />
- )}
- {toggleTarget && (
- <ToggleConfirmDialog
- row={toggleTarget.row}
- enable={toggleTarget.enable}
- onCancel={() => setToggleTarget(null)}
- onDone={(message, refresh) => {
- setToggleTarget(null);
- setNotice(message);
- if (refresh) center.reload();
- }}
- />
- )}
- {defRow && (
- <JobDefinitionDialog
- row={defRow}
- onClose={() => setDefRow(null)}
- onViewRuns={() => {
- const row = defRow;
- setDefRow(null);
- openRuns(row);
- }}
- />
- )}
- {runsPreset && (
- <JobRunsDialog preset={runsPreset} rows={center.rows} onClose={() => setRunsPreset(null)} />
- )}
- {notice && <OpsNotice message={notice} onClose={() => setNotice(null)} />}
- </section>
- );
- }
|