新增: 任务推进链(7态状态机+advance_task CAS原子写)+软删除+前后端7态对齐
This commit is contained in:
@@ -6,22 +6,19 @@
|
||||
// ── 项目状态 ──
|
||||
|
||||
// 值为 i18n key,实际文案走 $t('projects.status.<key>')(见 src/i18n/{zh-CN,en}/projects.ts)
|
||||
// F-09 对齐:删 in_progress/paused/cancelled(project 维度无数据产生源、无 UI 入口、无消费方),
|
||||
// 保留与后端真实生命周期一致的最小集(planning 常态 + 软删 deleted_at 由 list_deleted 单独处理)。
|
||||
export const PROJECT_STATUS_LABELS: Record<string, string> = {
|
||||
planning: 'projects.status.planning',
|
||||
in_progress: 'projects.status.in_progress',
|
||||
paused: 'projects.status.paused',
|
||||
completed: 'projects.status.completed',
|
||||
cancelled: 'projects.status.cancelled',
|
||||
active: 'projects.status.active',
|
||||
completed: 'projects.status.completed',
|
||||
}
|
||||
|
||||
/** 项目状态 → 卡片 badge 样式 class */
|
||||
export const PROJECT_STATUS_BADGE_CLASS: Record<string, string> = {
|
||||
planning: 'stage-design',
|
||||
in_progress: 'stage-coding',
|
||||
paused: 'stage-testing',
|
||||
active: 'stage-coding',
|
||||
completed: 'stage-release',
|
||||
cancelled: 'stage-design',
|
||||
}
|
||||
|
||||
/** 项目状态 → 阶段/进度信息(详情页 pipeline + Dashboard 进度条共用) */
|
||||
@@ -35,11 +32,9 @@ export interface ProjectStageInfo {
|
||||
}
|
||||
|
||||
export const PROJECT_STAGE_INFO: Record<string, ProjectStageInfo> = {
|
||||
planning: { stepIndex: 0, progress: 20, stage: 'coding' },
|
||||
in_progress: { stepIndex: 2, progress: 55, stage: 'coding' },
|
||||
paused: { stepIndex: 2, progress: 40, stage: 'testing' },
|
||||
planning: { stepIndex: 0, progress: 20, stage: 'planning' },
|
||||
active: { stepIndex: 2, progress: 55, stage: 'coding' },
|
||||
completed: { stepIndex: 4, progress: 100, stage: 'release' },
|
||||
cancelled: { stepIndex: 0, progress: 0, stage: 'testing' },
|
||||
}
|
||||
|
||||
export function projectStatusLabel(status: string): string {
|
||||
@@ -51,26 +46,41 @@ export function projectBadgeClass(status: string): string {
|
||||
}
|
||||
|
||||
export function projectStageInfo(status: string): ProjectStageInfo {
|
||||
return PROJECT_STAGE_INFO[status] ?? PROJECT_STAGE_INFO.planning
|
||||
// F-09:兜底用字面量而非 PROJECT_STAGE_INFO.planning,避免已删键的隐式依赖
|
||||
return PROJECT_STAGE_INFO[status] ?? { stepIndex: 0, progress: 0, stage: 'planning' }
|
||||
}
|
||||
|
||||
// ── 任务状态 ──
|
||||
|
||||
// D-260616-01:前端对齐后端 7 态纯状态机(crates/df-core/src/types.rs TaskStatus)
|
||||
// 删旧 5 态 Git 工作流导向(review_ready/merged/abandoned)。
|
||||
// 后端 task.rs update_task 写 status 经 TaskStatus::is_valid 拦截,旧 5 态无法落库;
|
||||
// migrations.rs V1 无 seed,create_task 默认 todo → 新 DB 无旧 5 态数据,安全对齐。
|
||||
//
|
||||
// 值为 i18n key,实际文案走 $t('tasks.status.<key>')(见 src/i18n/{zh-CN,en}/tasks.ts)
|
||||
export const TASK_STATUS_LABELS: Record<string, string> = {
|
||||
todo: 'tasks.status.todo',
|
||||
in_progress: 'tasks.status.in_progress',
|
||||
review_ready: 'tasks.status.review_ready',
|
||||
merged: 'tasks.status.merged',
|
||||
abandoned: 'tasks.status.abandoned',
|
||||
in_review: 'tasks.status.in_review',
|
||||
testing: 'tasks.status.testing',
|
||||
done: 'tasks.status.done',
|
||||
blocked: 'tasks.status.blocked',
|
||||
cancelled: 'tasks.status.cancelled',
|
||||
}
|
||||
|
||||
// class 名对齐既有 css(Tasks/TaskDetail/ProjectDetail 均有 status-todo/progress/review/done/abandoned):
|
||||
// - todo/in_progress/in_review/done 复用既有 class(保持跨视图样式一致,不破坏指派外文件)
|
||||
// - cancelled 复用 status-abandoned(同为 danger 红色,语义一致)
|
||||
// - testing/blocked 新增(Tasks.vue 自身样式补充;TaskDetail/ProjectDetail 遇此值兜底 status-todo 灰色,
|
||||
// 非破坏——仅样式保守,文案经 $t 正常渲染)
|
||||
export const TASK_STATUS_CLASS: Record<string, string> = {
|
||||
todo: 'status-todo',
|
||||
in_progress: 'status-progress',
|
||||
review_ready: 'status-review',
|
||||
merged: 'status-done',
|
||||
abandoned: 'status-abandoned',
|
||||
in_review: 'status-review',
|
||||
testing: 'status-testing',
|
||||
done: 'status-done',
|
||||
blocked: 'status-blocked',
|
||||
cancelled: 'status-abandoned',
|
||||
}
|
||||
|
||||
export function taskStatusLabel(status: string): string {
|
||||
|
||||
Reference in New Issue
Block a user