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
+17
View File
@@ -64,3 +64,20 @@ type RetryPublicationsBatchResult struct {
NotRetryable int `json:"not_retryable"`
Outcomes []RetryOutcome `json:"outcomes"`
}
// CancelOutcome constants reuse the retry vocabulary plus "cancelled".
const (
CancelCancelled = "cancelled"
)
// CancelPublicationsBatchRequest is the operator's "stop retrying" batch:
// 1..100 failed/stalled publications move to 'cancelled', their queued
// upload jobs are dropped and their open dead letters are abandoned.
// Source records and spooled artifacts are untouched; re-marking the file
// in 来源与目录 can still create a fresh publication later.
type CancelPublicationsBatchRequest struct {
PublicationIDs []string `json:"publication_ids"`
OperatorRef string `json:"operator_ref"`
Reason string `json:"reason"`
Now time.Time `json:"-"`
}
+5 -1
View File
@@ -133,11 +133,15 @@ const (
ProcessingCompleted ProcessingState = "completed"
ProcessingFailed ProcessingState = "failed"
ProcessingStalled ProcessingState = "stalled"
// ProcessingCancelled is the operator's "stop trying" decision on a
// permanently failing document (e.g. an empty DingTalk export). The
// publication leaves the attention lane; source data is untouched.
ProcessingCancelled ProcessingState = "cancelled"
)
func (state ProcessingState) Valid() bool {
switch state {
case ProcessingPending, ProcessingProcessing, ProcessingFinalizing, ProcessingCompleted, ProcessingFailed, ProcessingStalled:
case ProcessingPending, ProcessingProcessing, ProcessingFinalizing, ProcessingCompleted, ProcessingFailed, ProcessingStalled, ProcessingCancelled:
return true
default:
return false