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>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# Proposal: Add Delete Capability for Spaces and Projects
|
||||
|
||||
## Summary
|
||||
Enable users to delete workspaces (spaces) and projects from the frontend UI. The backend already supports soft deletion, but the frontend lacks the necessary UI components and service functions.
|
||||
|
||||
## Problem Statement
|
||||
Currently, users cannot delete spaces or projects from the UI even though:
|
||||
1. Backend DELETE endpoints exist (`DELETE /spaces/{id}`, `DELETE /projects/{id}`)
|
||||
2. Both implement soft-delete (setting `is_active = False`)
|
||||
3. Project deletion includes audit logging
|
||||
|
||||
Users must access the database directly or use API tools to delete items, which is not user-friendly.
|
||||
|
||||
## Proposed Solution
|
||||
Add frontend UI components and service functions to enable deletion:
|
||||
|
||||
1. **Frontend Services**: Add `deleteSpace()` and `deleteProject()` functions
|
||||
2. **Spaces Page**: Add delete button with confirmation dialog
|
||||
3. **Projects Page**: Add delete button with confirmation dialog
|
||||
4. **Translations**: Add i18n strings for delete UI elements
|
||||
|
||||
## Scope
|
||||
|
||||
### In Scope
|
||||
- Delete button UI for spaces (owner only)
|
||||
- Delete button UI for projects (owner only)
|
||||
- Confirmation dialogs with clear warning messages
|
||||
- i18n translations (zh-TW, en)
|
||||
- Audit trail (already implemented in backend for projects)
|
||||
|
||||
### Out of Scope
|
||||
- Hard delete (permanent removal from database)
|
||||
- Restore/undelete functionality
|
||||
- Cascading delete behavior changes (current soft-delete preserves child items)
|
||||
- Bulk delete operations
|
||||
|
||||
## Impact Analysis
|
||||
|
||||
### Affected Components
|
||||
| Component | Change Type | Description |
|
||||
|-----------|-------------|-------------|
|
||||
| `frontend/src/services/spaces.ts` | NEW | Add deleteSpace function |
|
||||
| `frontend/src/services/projects.ts` | MODIFY | Add deleteProject function |
|
||||
| `frontend/src/pages/Spaces.tsx` | MODIFY | Add delete button and dialog |
|
||||
| `frontend/src/pages/Projects.tsx` | MODIFY | Add delete button and dialog |
|
||||
| `frontend/public/locales/*/spaces.json` | MODIFY | Add delete translations |
|
||||
| `frontend/public/locales/*/projects.json` | MODIFY | Add delete translations |
|
||||
|
||||
### Dependencies
|
||||
- Backend DELETE endpoints (already implemented)
|
||||
- Audit service (already integrated for project deletion)
|
||||
- ToastContext for success/error notifications (already available)
|
||||
|
||||
## Risks & Mitigations
|
||||
|
||||
| Risk | Likelihood | Impact | Mitigation |
|
||||
|------|------------|--------|------------|
|
||||
| Accidental deletion | Medium | High | Require typed confirmation for spaces with projects |
|
||||
| Permission confusion | Low | Medium | Clear "owner only" messaging |
|
||||
|
||||
## Success Criteria
|
||||
1. Space owner can delete empty spaces with confirmation
|
||||
2. Space owner can delete spaces with projects (with strong warning)
|
||||
3. Project owner can delete projects with confirmation
|
||||
4. All deletions are logged in audit trail
|
||||
5. UI shows appropriate error messages for non-owners
|
||||
Reference in New Issue
Block a user