Files
PROJECT-CONTORL/frontend/src/services/projectHealth.ts
beabigegg 55f85d0d3c feat: implement soft delete, task editing fixes, and UI improvements
Backend:
- Add soft delete for spaces and projects (is_active flag)
- Add status_id and assignee_id to TaskUpdate schema
- Fix task PATCH endpoint to update status and assignee
- Add validation for assignee_id and status_id in task updates
- Fix health service to count tasks with "Blocked" status as blockers
- Filter out deleted spaces/projects from health dashboard
- Add workload cache invalidation on assignee changes

Frontend:
- Add delete confirmation dialogs for spaces and projects
- Fix UserSelect to display selected user name (valueName prop)
- Fix task detail modal to refresh data after save
- Enforce 2-level subtask depth limit in UI
- Fix timezone bug in date formatting (use local timezone)
- Convert NotificationBell from Tailwind to inline styles
- Add i18n translations for health, workload, settings pages
- Add parent_task_id to Task interface across components

OpenSpec:
- Archive add-delete-capability change

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 01:32:13 +08:00

62 lines
1.8 KiB
TypeScript

import api from './api'
// Types for Project Health API responses
export type RiskLevel = 'low' | 'medium' | 'high' | 'critical'
export type ScheduleStatus = 'on_track' | 'at_risk' | 'delayed'
export type ResourceStatus = 'adequate' | 'constrained' | 'overloaded'
export interface ProjectHealthItem {
id: string
project_id: string
health_score: number
risk_level: RiskLevel
schedule_status: ScheduleStatus
resource_status: ResourceStatus
last_updated: string
project_title: string
project_status: string
owner_name: string | null
space_name: string | null
task_count: number
completed_task_count: number
blocker_count: number
overdue_task_count: number
}
export interface ProjectHealthSummary {
total_projects: number
healthy_count: number // health_score >= 80 (low risk)
at_risk_count: number // health_score 60-79 (medium risk)
high_risk_count: number // health_score 40-59 (high risk)
critical_count: number // health_score < 40 (critical risk)
average_health_score: number
projects_with_blockers: number
projects_delayed: number
}
export interface ProjectHealthDashboardResponse {
projects: ProjectHealthItem[]
summary: ProjectHealthSummary
}
// API functions
export const projectHealthApi = {
/**
* Get project health dashboard with all projects
*/
getDashboard: async (): Promise<ProjectHealthDashboardResponse> => {
const response = await api.get<ProjectHealthDashboardResponse>('/projects/health/dashboard')
return response.data
},
/**
* Get health status for a single project
*/
getProjectHealth: async (projectId: string): Promise<ProjectHealthItem> => {
const response = await api.get<ProjectHealthItem>(`/projects/health/${projectId}`)
return response.data
},
}
export default projectHealthApi