7.4 KiB
Task 20 Implementation Summary: Bulk Status Update with Custom Statuses
Task Overview
Task: 20. Frontend: Update bulk status update to support custom statuses
Status: ✅ COMPLETED
Requirements:
- 10.1: Modify
TaskBulkActionsMenu.vue - 10.2: Fetch custom statuses for current project
- 10.3: Include custom statuses in bulk update dropdown
- 10.4: Validate all selected tasks are from same project
- 10.5: Show color indicators in dropdown
Implementation Summary
Successfully enhanced the TaskBulkActionsMenu component to support custom task statuses in bulk operations. The implementation includes fetching custom statuses from the API, validating that all selected tasks belong to the same project, and displaying both system and custom statuses with color indicators.
Changes Made
1. TaskBulkActionsMenu.vue
Props Added:
selectedTasks: Task[]- Array of selected tasks for validation
State Added:
systemStatuses- Array of system statuses from APIcustomStatuses- Array of custom statuses from APIisLoadingStatuses- Loading state for status fetching
Computed Properties Added:
hasMultipleProjects- Validates all tasks are from same projectcurrentProjectId- Gets project ID from first selected task
Methods Added:
fetchStatuses()- Fetches system and custom statuses from API
UI Enhancements:
- Warning message when multiple projects detected
- Loading indicator while fetching statuses
- Section labels for system vs custom statuses
- Color indicator dots for each status
- Disabled state when validation fails
2. TaskBrowser.vue
Changes:
- Pass
selectedTasksprop to TaskBulkActionsMenu - Updated
handleBulkStatusUpdateto acceptstringinstead ofTaskStatusenum
3. task.ts Service
Changes:
- Updated
bulkUpdateStatussignature to acceptstatus: string - Updated
BulkStatusUpdateRequestinterface to usestatus: string
Technical Details
Status Fetching Logic
const fetchStatuses = async () => {
if (!currentProjectId.value || hasMultipleProjects.value) {
systemStatuses.value = []
customStatuses.value = []
return
}
try {
isLoadingStatuses.value = true
const response = await customTaskStatusService.getAllStatuses(currentProjectId.value)
systemStatuses.value = response.system_statuses
customStatuses.value = response.statuses
} catch (error) {
console.error('Failed to fetch task statuses:', error)
systemStatuses.value = []
customStatuses.value = []
} finally {
isLoadingStatuses.value = false
}
}
Multi-Project Validation
const hasMultipleProjects = computed(() => {
if (props.selectedTasks.length === 0) return false
const projectIds = new Set(props.selectedTasks.map(task => task.project_id))
return projectIds.size > 1
})
Status Display with Colors
<DropdownMenuItem
v-for="status in customStatuses"
:key="status.id"
@click="handleStatusSelected(status.id)"
class="flex items-center gap-2"
>
<div
class="w-2 h-2 rounded-full flex-shrink-0"
:style="{ backgroundColor: status.color }"
/>
<span>{{ status.name }}</span>
</DropdownMenuItem>
User Experience Flow
Normal Operation (Single Project)
- User selects multiple tasks from same project
- Right-click opens context menu
- Click "Set Status" opens submenu
- Brief loading indicator appears
- System statuses shown with label and color dots
- Custom statuses shown with label and color dots
- User clicks desired status
- All tasks updated successfully
- Success toast displays count
Multi-Project Detection
- User selects tasks from different projects
- Right-click opens context menu
- Warning message: "Selected tasks are from different projects"
- "Set Status" button disabled
- "Assign To" buttons disabled
- User must adjust selection
Files Modified
-
frontend/src/components/task/TaskBulkActionsMenu.vue- Added selectedTasks prop
- Implemented status fetching
- Added multi-project validation
- Enhanced UI with color indicators
- Added loading/error states
-
frontend/src/components/task/TaskBrowser.vue- Pass selectedTasks to menu
- Updated status handler signature
-
frontend/src/services/task.ts- Updated bulkUpdateStatus to accept string
- Updated interface definitions
Testing
Test File Created
frontend/test-bulk-status-custom.html- Comprehensive test documentation
Manual Testing Checklist
- Select tasks from single project
- Open context menu
- Verify system statuses appear
- Verify custom statuses appear
- Verify color indicators display
- Click custom status
- Verify tasks update successfully
- Select tasks from multiple projects
- Verify warning message
- Verify buttons disabled
- Verify loading state
Requirements Coverage
| Requirement | Status | Implementation |
|---|---|---|
| 10.1: Modify TaskBulkActionsMenu.vue | ✅ Complete | Component updated with new props and logic |
| 10.2: Fetch custom statuses | ✅ Complete | Fetches via customTaskStatusService.getAllStatuses() |
| 10.3: Include custom statuses | ✅ Complete | Displays both system and custom in dropdown |
| 10.4: Validate same project | ✅ Complete | Computes hasMultipleProjects, disables on mismatch |
| 10.5: Show color indicators | ✅ Complete | Colored dots for all statuses |
Benefits
- Consistency: Same status options in bulk and individual updates
- Flexibility: Users can apply custom statuses to multiple tasks
- Safety: Prevents accidental cross-project updates
- Usability: Color indicators aid quick status identification
- Organization: Clear separation of system vs custom statuses
Integration Points
API Endpoints Used
GET /projects/{project_id}/task-statuses- Fetch all statusesPUT /tasks/bulk/status- Update multiple task statuses
Services Used
customTaskStatusService- Status managementtaskService- Bulk operations
Components Integrated
- TaskBrowser - Parent component
- TasksDataTable - Selection management
- TaskStatusBadge - Status display (not used in this component)
Documentation Created
frontend/docs/bulk-status-custom-support.md- Detailed implementation guidefrontend/test-bulk-status-custom.html- Test documentationfrontend/docs/task-20-implementation-summary.md- This summary
Next Steps
The implementation is complete and ready for:
- Manual testing in the application
- User acceptance testing
- Integration with task 21 (reactive status updates)
Related Tasks
- Task 17: TaskStatusBadge custom colors (completed)
- Task 18: EditableTaskStatus custom support (completed)
- Task 19: TaskStatusFilter custom support (completed)
- Task 21: Reactive status updates across UI (next)
Notes
- The component now accepts string status IDs instead of enum values
- This allows seamless support for both system and custom statuses
- Multi-project validation ensures data integrity
- Loading states provide good user feedback
- Error handling prevents crashes on API failures
Conclusion
Task 20 has been successfully implemented with all requirements met. The bulk status update feature now fully supports custom task statuses with proper validation, color indicators, and user-friendly error handling. The implementation maintains backward compatibility with system statuses while extending functionality to support project-specific custom statuses.