|
@@ -12,7 +12,7 @@ import { useMemo, useState } from "react";
|
|
|
import { PageIntro } from "../components/PageIntro";
|
|
import { PageIntro } from "../components/PageIntro";
|
|
|
import { CalendarClock, ChevronDown, History, Info, TriangleAlert, Wrench, X } from "lucide-react";
|
|
import { CalendarClock, ChevronDown, History, Info, TriangleAlert, Wrench, X } from "lucide-react";
|
|
|
import { Button } from "../components/ui/button";
|
|
import { Button } from "../components/ui/button";
|
|
|
-import { OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
|
|
|
|
|
|
|
+import { OpsDialog, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
|
|
|
import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
|
|
import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
|
|
|
import { useDemoIdentity } from "../lib/demo-session";
|
|
import { useDemoIdentity } from "../lib/demo-session";
|
|
|
import {
|
|
import {
|
|
@@ -167,18 +167,13 @@ function ToggleConfirmDialog({
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* ── 作业定义弹窗(契约 作业§3.4:11 行+底注 W25+固定按钮) ────────── */
|
|
|
|
|
|
|
+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 }) {
|
|
function JobDefinitionDialog({ row, onClose, onViewRuns }: { row: JobListRow; onClose: () => void; onViewRuns: () => void }) {
|
|
|
- const stateText = row.annotation
|
|
|
|
|
- ? STATE_NO_SWITCH
|
|
|
|
|
- : !row.wired
|
|
|
|
|
- ? STATE_NOT_WIRED
|
|
|
|
|
- : row.enabled === true
|
|
|
|
|
- ? STATE_ENABLED
|
|
|
|
|
- : row.enabled === false
|
|
|
|
|
- ? STATE_DISABLED
|
|
|
|
|
- : "—";
|
|
|
|
|
const planText = row.annotation
|
|
const planText = row.annotation
|
|
|
? "—"
|
|
? "—"
|
|
|
: !row.wired
|
|
: !row.wired
|
|
@@ -189,35 +184,55 @@ function JobDefinitionDialog({ row, onClose, onViewRuns }: { row: JobListRow; on
|
|
|
? row.cronHint
|
|
? row.cronHint
|
|
|
: "—";
|
|
: "—";
|
|
|
return (
|
|
return (
|
|
|
- <div className="ops-confirm-backdrop" role="presentation" onMouseDown={onClose}>
|
|
|
|
|
- <div className="ops-confirm ops-jobdef-dialog" role="dialog" aria-modal="true" aria-labelledby="jobdef-title" onMouseDown={(event) => event.stopPropagation()}>
|
|
|
|
|
- <h2 id="jobdef-title">{w24(row.key)}</h2>
|
|
|
|
|
- <dl className="ops-jobdef-list">
|
|
|
|
|
- <div><dt>任务编码</dt><dd className="ops-mono">{row.key}</dd></div>
|
|
|
|
|
- <div><dt>任务名称(注册契约)</dt><dd>{row.registryName}</dd></div>
|
|
|
|
|
- <div><dt>调度时点</dt><dd>{row.annotation ? ANNOTATION_SUBMIT : row.cronHint}</dd></div>
|
|
|
|
|
- <div><dt>触发方式</dt><dd>{row.triggerText}</dd></div>
|
|
|
|
|
- <div><dt>处理对象</dt><dd>{row.objectScope ?? "—"}</dd></div>
|
|
|
|
|
- <div><dt>执行动作</dt><dd>{row.actionText ?? "—"}</dd></div>
|
|
|
|
|
- <div><dt>幂等口径</dt><dd>{row.idempotencyText ?? "—"}</dd></div>
|
|
|
|
|
- <div><dt>当前状态</dt><dd>{stateText}</dd></div>
|
|
|
|
|
- <div><dt>下轮计划</dt><dd>{planText}</dd></div>
|
|
|
|
|
- <div><dt>累计执行轮次</dt><dd>{row.runCount ?? 0}</dd></div>
|
|
|
|
|
|
|
+ <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>
|
|
<div>
|
|
|
<dt>最近一次执行</dt>
|
|
<dt>最近一次执行</dt>
|
|
|
- <dd>{row.lastRunAt ? `${fmtDateTime(row.lastRunAt)} · ${row.lastStatus ?? ""}` : row.annotation ? `—(${NEVER_RUN}不适用)` : NEVER_RUN}</dd></div>
|
|
|
|
|
|
|
+ <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>
|
|
</dl>
|
|
|
- <p className="ops-import-note">{W25}</p>
|
|
|
|
|
- <div>
|
|
|
|
|
- <Button type="button" variant="ghost" onClick={onClose}>
|
|
|
|
|
- 关闭
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button type="button" onClick={onViewRuns}>
|
|
|
|
|
- {W23_VIEW_RUNS}
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <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>
|
|
</div>
|
|
|
|
|
+ <p className="job-definition-note">{W25}</p>
|
|
|
</div>
|
|
</div>
|
|
|
- </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>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -417,13 +432,7 @@ export function ScheduledJobManagementPage() {
|
|
|
</>
|
|
</>
|
|
|
) : NEVER_RUN}
|
|
) : NEVER_RUN}
|
|
|
</td>
|
|
</td>
|
|
|
- <td>
|
|
|
|
|
- {row.lastStatus && !row.annotation ? (
|
|
|
|
|
- <OpsStatus tone={row.lastStatusTone === "success" ? "success" : row.lastStatusTone === "failed" ? "danger" : "warning"}>
|
|
|
|
|
- {row.lastStatus}
|
|
|
|
|
- </OpsStatus>
|
|
|
|
|
- ) : "—"}
|
|
|
|
|
- </td>
|
|
|
|
|
|
|
+ <td>{row.lastStatus && !row.annotation ? <RunStatus row={row} /> : "—"}</td>
|
|
|
<td>
|
|
<td>
|
|
|
{row.annotation ? "—" : counts ? (
|
|
{row.annotation ? "—" : counts ? (
|
|
|
<span className="job-ledger-counts ops-mono">
|
|
<span className="job-ledger-counts ops-mono">
|