LinkDesk/.kiro/specs/task-browser-bulk-actions/tasks.md

180 lines
5.8 KiB
Markdown

# Implementation Plan
- [x] 1. Set up backend bulk action endpoints
- Create bulk status update endpoint in `backend/routers/tasks.py`
- Create bulk assignment endpoint in `backend/routers/tasks.py`
- Implement transaction handling for atomicity
- Add request/response schemas in `backend/schemas/task.py`
- _Requirements: 4.2, 4.4, 5.3, 5.5_
- [ ]* 1.1 Write property test for bulk status update atomicity
- **Property 4: Bulk status update atomicity**
- **Validates: Requirements 4.2, 4.4**
- [ ]* 1.2 Write property test for bulk assignment atomicity
- **Property 5: Bulk assignment atomicity**
- **Validates: Requirements 5.3, 5.5**
- [x] 2. Update task service with bulk action methods
- Add `bulkUpdateStatus` method to `frontend/src/services/task.ts`
- Add `bulkAssignTasks` method to `frontend/src/services/task.ts`
- Define TypeScript interfaces for bulk action requests and responses
- _Requirements: 4.2, 5.3_
- [x] 3. Add checkbox selection column to TaskBrowser
- Update `frontend/src/components/task/columns.ts` to add select column
- Implement header checkbox for select all functionality
- Implement row checkboxes for individual selection
- Ensure checkbox column is not sortable or hideable
- _Requirements: 1.1, 1.2, 1.3_
- [ ]* 3.1 Write property test for selection state consistency
- **Property 1: Selection state consistency**
- **Validates: Requirements 1.2, 1.3, 2.3**
- [x] 4. Implement row selection state in TaskBrowser
- Add `rowSelection` state using TanStack Table's row selection
- Configure table with `enableRowSelection: true`
- Add computed property for `selectedTasks` array
- Add computed property for `selectedCount`
- Implement visual feedback for selected rows (background highlight)
- _Requirements: 1.2, 1.3, 1.4, 2.1, 2.2, 2.3_
- [x] 5. Implement selection count display
- Update task count display area to show selection count when tasks are selected
- Show format: "X tasks selected" when selection is active
- Show normal count when no selection
- _Requirements: 2.1, 2.2, 2.3_
- [x] 6. Implement filter-based selection clearing
- Add watchers for filter changes (status, type, episode, assignee, context, search)
- Clear `rowSelection` state when any filter changes
- _Requirements: 1.5_
- [ ]* 6.1 Write property test for filter clears selection
- **Property 2: Filter clears selection**
- **Validates: Requirements 1.5**
- [x] 7. Create TaskBulkActionsMenu component
- Create new component at `frontend/src/components/task/TaskBulkActionsMenu.vue`
- Use DropdownMenu from shadcn-vue for base structure
- Implement absolute positioning based on cursor coordinates
- Add viewport boundary detection for menu positioning
- Create "Set Status" menu item with status submenu
- Create "Assign To" menu item with user list submenu
- Emit events for status-selected and assignee-selected
- _Requirements: 3.1, 3.3, 4.1, 5.1, 5.2_
- [x] 8. Implement context menu trigger in TaskBrowser
- Add `@contextmenu` event handler to table rows
- Implement `handleContextMenu` method to position and show menu
- Ensure right-clicked unselected row gets selected before menu shows
- Add click-outside handler to close context menu
- Prevent context menu on empty table areas
- _Requirements: 3.1, 3.2, 3.3, 3.4_
- [ ]* 8.1 Write property test for context menu task inclusion
- **Property 3: Context menu task inclusion**
- **Validates: Requirements 3.2**
- [x] 9. Implement bulk status update action
- Create `handleBulkStatusUpdate` method in TaskBrowser
- Extract selected task IDs from selection state
- Call `taskService.bulkUpdateStatus` with task IDs and new status
- Show loading state during operation
- Display success toast with count of updated tasks
- Handle errors and display error toast
- Refresh task list after successful update
- Close context menu and clear selection after completion
- _Requirements: 4.2, 4.3, 4.4, 4.5, 6.1, 6.3_
- [x] 10. Implement bulk assignment action
- Create `handleBulkAssignment` method in TaskBrowser
- Extract selected task IDs from selection state
- Call `taskService.bulkAssignTasks` with task IDs and user ID
- Show loading state during operation
- Display success toast with count of assigned tasks
- Handle errors and display error toast
- Refresh task list after successful update
- Close context menu and clear selection after completion
- _Requirements: 5.3, 5.4, 5.5, 5.6, 6.1, 6.3_
- [ ] 11. Implement keyboard shortcuts
- Add `@keydown` event handler to table container
- Implement Ctrl+A (Cmd+A on Mac) to select all visible tasks
- Implement Escape to clear selection and close context menu
- Implement Ctrl+Click (Cmd+Click on Mac) for toggle selection
- Implement Shift+Click for range selection
- Track `lastSelectedIndex` for range selection
- _Requirements: 7.1, 7.2, 7.3, 7.4_
- [ ]* 11.1 Write property test for Ctrl+A selection
- **Property 6: Keyboard shortcut selection**
- **Validates: Requirements 7.1**
- [ ]* 11.2 Write property test for Shift-click range selection
- **Property 7: Shift-click range selection**
- **Validates: Requirements 7.4**
- [ ] 12. Add loading and disabled states
- Add `isProcessingBulkAction` state flag
- Disable context menu options during bulk operations
- Show loading spinner or disabled state in menu
- Prevent duplicate operations while processing
- _Requirements: 6.2_
- [ ]* 13. Write unit tests for edge cases
- Test empty selection state handling
- Test single task selection
- Test select all with no tasks
- Test context menu positioning at viewport edges
- Test keyboard event handling with various modifier keys
- [ ] 14. Final checkpoint - Ensure all tests pass
- Ensure all tests pass, ask the user if questions arise.