86732ca987
逐项明细 DTO 漏了 action(前端 parseReleaseItemExecution 必需),点 「查看结果」整个明细区报 invalid release item execution。同时把遷移 000044 的 target_knowledge_base_id 读出来透出,页面逐项结果显示「目标库」, 让'目标知识库可选'在界面上可核对。测试:Go 契约用例 + 前端解析回归用例。
118 lines
4.2 KiB
Go
118 lines
4.2 KiB
Go
package governance
|
|
|
|
import "time"
|
|
|
|
type ReleaseOperation string
|
|
|
|
const (
|
|
ReleaseOperationPublish ReleaseOperation = "publish"
|
|
ReleaseOperationRollback ReleaseOperation = "rollback"
|
|
)
|
|
|
|
func (operation ReleaseOperation) Valid() bool {
|
|
return operation == ReleaseOperationPublish || operation == ReleaseOperationRollback
|
|
}
|
|
|
|
type ReleaseExecutionState string
|
|
|
|
const (
|
|
ReleaseExecutionPending ReleaseExecutionState = "pending"
|
|
ReleaseExecutionRunning ReleaseExecutionState = "running"
|
|
// R4: a rollback execution compensates in rolling_back and terminates in
|
|
// rolled_back (all compensated) or rollback_failed (manual action needed).
|
|
ReleaseExecutionRollingBack ReleaseExecutionState = "rolling_back"
|
|
ReleaseExecutionRolledBack ReleaseExecutionState = "rolled_back"
|
|
ReleaseExecutionRollbackFailed ReleaseExecutionState = "rollback_failed"
|
|
ReleaseExecutionCompleted ReleaseExecutionState = "completed"
|
|
ReleaseExecutionFailed ReleaseExecutionState = "failed"
|
|
)
|
|
|
|
func (state ReleaseExecutionState) Valid() bool {
|
|
switch state {
|
|
case ReleaseExecutionPending, ReleaseExecutionRunning, ReleaseExecutionRollingBack,
|
|
ReleaseExecutionRolledBack, ReleaseExecutionRollbackFailed,
|
|
ReleaseExecutionCompleted, ReleaseExecutionFailed:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
type ReleaseExecution struct {
|
|
ID string `json:"id"`
|
|
ReleaseBatchID string `json:"release_batch_id"`
|
|
Operation ReleaseOperation `json:"operation"`
|
|
PriorExecutionID string `json:"prior_execution_id"`
|
|
State ReleaseExecutionState `json:"state"`
|
|
FailureLevel string `json:"failure_level"`
|
|
RestoreTrigger string `json:"restore_trigger"`
|
|
ReleaseChangeSetID string `json:"release_change_set_id"`
|
|
TargetEnvironment string `json:"target_environment"`
|
|
AuthorizedBy string `json:"authorized_by"`
|
|
AuthorizationCode string `json:"authorization_code"`
|
|
JobID string `json:"job_id"`
|
|
ManifestSHA256 string `json:"manifest_sha256"`
|
|
ItemCount int `json:"item_count"`
|
|
BatchSize int `json:"batch_size"`
|
|
CurrentBatch int `json:"current_batch"`
|
|
TotalBatches int `json:"total_batches"`
|
|
CompletedItemCount int `json:"completed_item_count"`
|
|
FailedItemCount int `json:"failed_item_count"`
|
|
ErrorCode string `json:"error_code"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
StartedAt *time.Time `json:"started_at"`
|
|
CompletedAt *time.Time `json:"completed_at"`
|
|
}
|
|
|
|
type AuthorizeReleaseBatchRequest struct {
|
|
BatchID string
|
|
AuthorizedBy string
|
|
AuthorizationCode string
|
|
Now time.Time
|
|
}
|
|
|
|
type AuthorizeReleaseRollbackRequest struct {
|
|
PriorExecutionID string
|
|
AuthorizedBy string
|
|
AuthorizationCode string
|
|
Now time.Time
|
|
}
|
|
|
|
type RetryReleaseExecutionRequest struct {
|
|
ExecutionID string
|
|
Now time.Time
|
|
}
|
|
|
|
type ReleaseExecutionFilter struct {
|
|
Operation string
|
|
State string
|
|
Limit int
|
|
Offset int
|
|
}
|
|
|
|
type ReleaseExecutionPage struct {
|
|
Items []ReleaseExecution
|
|
Total int
|
|
Limit int
|
|
Offset int
|
|
}
|
|
|
|
type ReleaseItemExecutionView struct {
|
|
PublicationID string `json:"publication_id"`
|
|
Title string `json:"title"`
|
|
Action string `json:"action"`
|
|
State string `json:"state"`
|
|
PreviousProductionRevision string `json:"previous_production_revision"`
|
|
ProductionRevision string `json:"production_revision"`
|
|
ErrorCode string `json:"error_code"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
CompletedAt *time.Time `json:"completed_at"`
|
|
// TargetKnowledgeBaseID 是该项冻结的目标知识库(迁移 000044 起)。旧行可能为空。
|
|
TargetKnowledgeBaseID string `json:"target_knowledge_base_id"`
|
|
}
|
|
|
|
type ReleaseExecutionDetail struct {
|
|
ReleaseExecution
|
|
Items []ReleaseItemExecutionView `json:"items"`
|
|
}
|