完善任务部分成功状态与运行概览
补充证书部署部分成功的任务状态、HTTP响应和前端任务展示,并增加对应测试。
This commit is contained in:
1 parent
a9f17c740a
commit
2b9d82df2f
7 files changed
+70
-13
No files matched your search
@@ -163,6 +163,9 @@ export function useDashboard() {
|
||||
success: "已完成",
|
||||
failed: "失败",
|
||||
cancelled: "已取消",
|
||||
cancelling: "\u53d6\u6d88\u4e2d",
|
||||
retry_wait: "\u7b49\u5f85\u91cd\u8bd5",
|
||||
partial_success: "\u90e8\u5206\u6210\u529f",
|
||||
};
|
||||
taskStatusLabels.error = taskStatusLabels.failed;
|
||||
const taskTypeLabels = {
|
||||
@@ -216,6 +219,9 @@ export function useDashboard() {
|
||||
success: "已完成",
|
||||
failed: "失败",
|
||||
cancelled: "已取消",
|
||||
cancelling: "\u53d6\u6d88\u4e2d",
|
||||
retry_wait: "\u7b49\u5f85\u91cd\u8bd5",
|
||||
partial_success: "\u90e8\u5206\u6210\u529f",
|
||||
};
|
||||
const domainStatusLabels = {
|
||||
pending: "等待申请",
|
||||
|
||||
@@ -341,6 +341,8 @@ test("管理续期的任务类型、审计和阶段使用中文", async (t) => {
|
||||
assert.equal(state.auditActionLabel("management_renewal"), "管理证书续期");
|
||||
assert.equal(state.taskStageLabel("activate"), "激活管理证书");
|
||||
assert.equal(state.taskStageLabel("retry_wait"), "等待续期重试");
|
||||
assert.equal(state.taskStatusLabels.partial_success, "\u90e8\u5206\u6210\u529f");
|
||||
assert.equal(state.attemptStatusLabels.retry_wait, "\u7b49\u5f85\u91cd\u8bd5");
|
||||
});
|
||||
|
||||
test("已保存凭据不变可保存,输入新凭据必须重新验证", async (t) => {
|
||||
@@ -946,12 +948,12 @@ test("runtimeOverview.handlesEmptyDataThresholdsAndTaskOrdering", () => {
|
||||
for (const key of ["total", "valid", "expiring", "expired", "missing", "autoRenew", "configuredServers", "boundDomains", "activeTasks", "failedTasks"]) assert.equal(empty[key], 0);
|
||||
for (const value of [0, -1, "invalid"]) assert.equal(summarizeRuntime({ settings: { acme: { renewal_near_expiry_days: value } } }).threshold, 10);
|
||||
assert.equal(summarizeRuntime({ settings: { acme: { renewal_near_expiry_days: 30 } } }).threshold, 30);
|
||||
const tasks = ["queued", "running", "failed", "error", "success", "cancelled"].map((status, index) => ({ id: index, status, created_at: `2026-09-25T12:0${index}:00Z` }));
|
||||
const tasks = ["queued", "running", "retry_wait", "cancelling", "failed", "error", "success", "cancelled"].map((status, index) => ({ id: index, status, created_at: `2026-09-25T12:0${index}:00Z` }));
|
||||
const original = structuredClone(tasks);
|
||||
const result = summarizeRuntime({ tasks });
|
||||
assert.equal(result.activeTasks, 2);
|
||||
assert.equal(result.activeTasks, 4);
|
||||
assert.equal(result.failedTasks, 2);
|
||||
assert.deepEqual(result.tasks.map((item) => item.id), [5, 4, 3, 2, 1, 0]);
|
||||
assert.deepEqual(result.tasks.map((item) => item.id), [7, 6, 5, 4, 3, 2, 1, 0]);
|
||||
assert.deepEqual(tasks, original);
|
||||
assert.equal(runtimeTime(null), runtimeTime("invalid"));
|
||||
assert.doesNotMatch(runtimeTime("2026-09-25T12:00:00Z"), /Invalid/);
|
||||
|
||||
@@ -53,7 +53,7 @@ export function summarizeRuntime(data, now = Date.now()) {
|
||||
autoRenew: domains.filter((item) => item.auto_renew === true).length,
|
||||
configuredServers: (data.servers || []).length,
|
||||
boundDomains: domains.filter((item) => (data.domainServers?.[item.id] || []).length > 0).length,
|
||||
activeTasks: tasks.filter((item) => item.status === "queued" || item.status === "running").length,
|
||||
activeTasks: tasks.filter((item) => ["queued", "running", "retry_wait", "cancelling"].includes(item.status)).length,
|
||||
failedTasks: tasks.filter((item) => item.status === "failed" || item.status === "error").length,
|
||||
tasks,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user