feat(monitor): 取消失败发布并修正危险按钮对比度

- Parse-monitor: the batch-retry button rendered red-on-red because
  weknoraMonitor.css overrode the global .danger style with text color
  only; make .danger a filled red button with proper hover/disabled states.
- Add operator cancel: 批量取消所选 / per-task 不再处理 buttons move
  failed/stalled publications to a new 'cancelled' state in one audited
  batch operation (POST /api/v1/test-publications/cancel-batch, idempotent,
  migration 000041 widens the CHECK constraints). Queued upload jobs are
  cancelled, open dead letters abandoned; source records and spool files
  stay intact so re-marking in the catalog can retry later.
- Queue status filter and labels learn 已取消; OpenAPI contract updated.
This commit is contained in:
姚章浩
2026-09-15 17:58:40 +08:00
parent 822896ea6c
commit 5037c05e93
13 changed files with 476 additions and 14 deletions
+129 -1
View File
@@ -1422,7 +1422,8 @@
"finalizing",
"completed",
"failed",
"stalled"
"stalled",
"cancelled"
]
}
},
@@ -1941,6 +1942,133 @@
"operationId": "retryPublicationsBatch"
}
},
"/api/v1/test-publications/cancel-batch": {
"post": {
"summary": "服务端批量取消失败发布(不再自动重试)",
"description": "用于源头即空文档等永久性失败:一次事务内把 failed/stalled 发布置为 cancelled,撤销排队中的上传任务并放弃对应死信;逐项返回 cancelled/already_running/not_retryable。原始记录与暂存文件保留,重新标记入库可再次处理。最多100项,操作人与原因由服务端会话注入并原子审计。",
"parameters": [
{
"$ref": "#/components/parameters/IdempotencyKey"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"publication_ids": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"type": "string"
}
},
"reason": {
"type": "string",
"minLength": 1,
"maxLength": 500
}
},
"required": [
"publication_ids",
"reason"
]
}
}
}
},
"responses": {
"200": {
"description": "批量取消结果(含逐项outcome)",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"batch_key": {
"type": "string"
},
"total": {
"type": "integer"
},
"started": {
"type": "integer",
"description": "成功取消的项数"
},
"already_running": {
"type": "integer"
},
"not_retryable": {
"type": "integer",
"description": "不可取消的项数(如已完成或不在失败态)"
},
"outcomes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"publication_id": {
"type": "string"
},
"result": {
"type": "string",
"enum": [
"cancelled",
"already_running",
"not_retryable"
]
},
"detail": {
"type": "string"
}
}
}
}
},
"required": [
"batch_key",
"total",
"started",
"already_running",
"not_retryable",
"outcomes"
]
},
"operation": {
"type": "string",
"enum": [
"created",
"replayed"
]
}
},
"required": [
"data",
"operation"
]
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
},
"operationId": "cancelPublicationsBatch"
}
},
"/api/v1/monitor/metrics": {
"get": {
"operationId": "getMonitorMetrics",