|
| 1 | +# Implementation Plan - Presubmit Dashboard Job Filtering |
| 2 | + |
| 3 | +This plan outlines the steps to add job filtering to the Presubmit Dashboard in the Cocoon dashboard. |
| 4 | + |
| 5 | +## Phase 1: State Management (PresubmitState) [checkpoint: 48bff29] |
| 6 | +In this phase, we will extend `PresubmitState` to hold and manage the filter state. |
| 7 | + |
| 8 | +- [x] **Task: Add filter state variables to `PresubmitState`.** |
| 9 | + - Variables: `Set<TaskStatus> selectedStatuses`, `Set<String> selectedPlatforms`, `String? jobNameFilter`. |
| 10 | + - Initialize with all statuses and platforms selected, and `null` or empty string for regex. |
| 11 | +- [x] **Task: Add methods to update filter state.** |
| 12 | + - `updateFilters({Set<TaskStatus>? statuses, Set<String>? platforms, String? jobNameFilter})` |
| 13 | + - `clearFilters()`: Resets filters to "select all" and clear regex. |
| 14 | +- [x] **Task: Implement filtering logic in `PresubmitState`.** |
| 15 | + - Add a getter `filteredGuardResponse` (or similar) that returns a `PresubmitGuardResponse` with filtered stages and builds based on the active filters. |
| 16 | + - Platforms are extracted by splitting job names by space and taking the first part. |
| 17 | +- [x] **Task: Add unit tests for `PresubmitState` filtering logic.** |
| 18 | + - Verify filtering by status, platform, and regex. |
| 19 | + - Verify persistence when `update` is called with same PR but different SHA. |
| 20 | +- [x] **Task: Conductor - User Manual Verification 'Phase 1: State Management' (Protocol in workflow.md)** |
| 21 | + |
| 22 | +## Phase 2: Filter Dialog UI [checkpoint: 2903a30] |
| 23 | +In this phase, we will create the filter dialog and its components. |
| 24 | + |
| 25 | +- [x] **Task: Create `FilterDialog` widget in `dashboard/lib/widgets/filter_dialog.dart`.** |
| 26 | + - Multi-select sections for Task Status and Platform. |
| 27 | + - `TextField` for Job Name Regex (with `onChanged` or `onEditingComplete` depending on final behavior). |
| 28 | + - Validation: Ensure at least one status and one platform are always selected (disable uncheck if it's the last one). |
| 29 | + - "Clear all filters" button at the bottom. |
| 30 | + - "Show N jobs" button displaying the filtered count. |
| 31 | +- [x] **Task: Add unit tests for `FilterDialog`.** |
| 32 | + - Verify initial state shows all filters. |
| 33 | + - Verify toggling selections updates the UI and buttons. |
| 34 | +- [x] **Task: Conductor - User Manual Verification 'Phase 2: Filter Dialog UI' (Protocol in workflow.md)** |
| 35 | + |
| 36 | +## Phase 3: Integration and Dashboard UI [checkpoint: b499002] |
| 37 | +In this phase, we will integrate the filter functionality into the Presubmit Dashboard. |
| 38 | + |
| 39 | +- [x] **Task: Add Filter Button to `CocoonAppBar` in `PreSubmitView`.** |
| 40 | + - Icon: `Icons.filter_alt_outlined` (no filters applied) or `Icons.filter_alt` (some filters applied). |
| 41 | + - Tooltip: "Filter jobs". |
| 42 | + - Hover highlight: "Filter jobs". |
| 43 | +- [x] **Task: Update `PreSubmitView` to use `filteredGuardResponse` for `_ChecksSidebar`.** |
| 44 | +- [x] **Task: Ensure filter state persists when switching guard statuses.** |
| 45 | + - Handled by `PresubmitState` during `update` calls. |
| 46 | +- [x] **Task: Add integration tests for filtering functionality in `PreSubmitView`.** |
| 47 | + - Verify clicking the filter button opens the dialog. |
| 48 | + - Verify applying filters updates the `_ChecksSidebar`. |
| 49 | +- [x] **Task: Conductor - User Manual Verification 'Phase 3: Integration and Dashboard UI' (Protocol in workflow.md)** |
| 50 | + |
| 51 | +## Phase 4: Final Polishing and Cleanup [checkpoint: e03cad0] |
| 52 | +- [x] **Task: Verify overall dashboard performance with active filters.** |
| 53 | +- [x] **Task: Ensure accessibility (ARIA labels, tooltips).** |
| 54 | +- [x] **Task: Conductor - User Manual Verification 'Phase 4: Final Polishing and Cleanup' (Protocol in workflow.md)** |
0 commit comments