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
@@ -0,0 +1,11 @@
-- Roll back the cancelled state; any cancelled row is re-opened as failed
-- first so the tighter CHECK applies.
UPDATE test_publications SET processing_state = 'failed' WHERE processing_state = 'cancelled';
ALTER TABLE test_publications DROP CONSTRAINT IF EXISTS test_publications_processing_state_check;
ALTER TABLE test_publications ADD CONSTRAINT test_publications_processing_state_check
CHECK (processing_state IN ('planned', 'pending', 'processing', 'finalizing', 'completed', 'failed', 'stalled'));
ALTER TABLE job_retry_operations DROP CONSTRAINT IF EXISTS job_retry_operations_outcome_check;
ALTER TABLE job_retry_operations ADD CONSTRAINT job_retry_operations_outcome_check
CHECK (outcome IN ('started', 'already_running', 'not_retryable'));
@@ -0,0 +1,11 @@
-- Documents whose parsing keeps failing (e.g. DingTalk exports an empty body)
-- can now be explicitly cancelled by an operator: the publication stops being
-- retryable and disappears from the attention lane, while the original record
-- stays untouched for a future re-mark.
ALTER TABLE test_publications DROP CONSTRAINT IF EXISTS test_publications_processing_state_check;
ALTER TABLE test_publications ADD CONSTRAINT test_publications_processing_state_check
CHECK (processing_state IN ('planned', 'pending', 'processing', 'finalizing', 'completed', 'failed', 'stalled', 'cancelled'));
ALTER TABLE job_retry_operations DROP CONSTRAINT IF EXISTS job_retry_operations_outcome_check;
ALTER TABLE job_retry_operations ADD CONSTRAINT job_retry_operations_outcome_check
CHECK (outcome IN ('started', 'already_running', 'not_retryable', 'cancelled'));