DFE-Digital / DFE-Digital/compass
Manage project RAG statuses
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 0
- Forks
- 1
- Avg merge
- 1m
- Merged PRs (30d)
- 3
Description
Task: Manage RAG Status Settings in Admin
Description
Add admin management functionality for RAG statuses, allowing administrators to create, edit, deactivate, and configure CSS classes for each status. This replaces hardcoded RAG status values with a configurable lookup table, similar to the existing Phases management.
Background
Currently, RAG statuses (Green, Amber-Green, Amber, Amber-Red, Red) are hardcoded throughout the application. This makes it difficult to:
- Add or modify RAG statuses
- Customize badge styling per status
- Deactivate statuses without code changes
- Maintain consistency across the application
Requirements
Admin Interface
- Create admin page at
/Admin/RagStatuses(following the Phases management pattern) - Allow admins to:
- View all RAG statuses in a table (sorted by SortOrder, then Name)
- Create new RAG statuses with:
- Name (required, max 100 chars)
- Description (optional)
- Sort Order (for display ordering)
- CSS Class (for badge styling, e.g., "badge badge-green")
- Active/Inactive status
- Edit existing RAG statuses
- Delete RAG statuses (with validation to prevent deletion if in use by projects)
- Set statuses as Active/Inactive
Data Model
- Create
RagStatusLookupmodel with:- Id, Name, Description, SortOrder, IsActive, CssClass, CreatedAt, UpdatedAt
- Add
RagStatusLookupsDbSet toCompassDbContext - Update
Projectmodel to useRagStatusLookupIdforeign key - Update
ProjectRagHistorymodel to useRagStatusLookupIdforeign key - Maintain backward compatibility with existing
RagStatusstring property (marked as obsolete)
Application Updates
- Update
UpdateRagStatusaction to use lookup IDs instead of strings - Update
_RagTracking.cshtmlview to:- Load RAG statuses from lookup table
- Use CSS classes from lookup for badge styling
- Fall back to legacy string-based logic for backward compatibility
- Update
Detailsaction to includeRagStatusLookupin queries and load active statuses - Add CSS classes to
service-manual.cssfor default RAG status badges
Acceptance Criteria
- Admin can access RAG statuses management page at
/Admin/RagStatuses - Admin can create new RAG statuses with all required fields
- Admin can edit existing RAG statuses
- Admin can set RAG statuses as Active/Inactive
- Admin cannot delete RAG statuses that are in use by projects
- RAG statuses are displayed in sort order (SortOrder, then Name)
- CSS classes can be set per RAG status for badge styling
- Project RAG status updates use the lookup table
- RAG status badges use CSS classes from the lookup table
- Backward compatibility is maintained for existing
RagStatusstring values - All existing RAG status functionality continues to work
Technical Implementation Notes
- Follow the existing Phases management pattern (
AdminController.Phases()actions andViews/Admin/Settings/Phases.cshtml) - Use Entity Framework migrations to add the
RagStatusLookupstable - Seed initial RAG statuses (Green, Amber-Green, Amber, Amber-Red, Red) with appropriate CSS classes
- CSS classes should be added to
service-manual/wwwroot/css/service-manual.css - The
RagStatusstring property should be marked with[Obsolete]attribute but kept for backward compatibility
Related Work
- Epic: Administration functions
- Feature: Application wide settings
- Related: Phase management (similar pattern)
Dependencies
- Database migration required
- Initial data seeding required for existing RAG statuses
Testing Checklist
- Test creating new RAG status
- Test editing existing RAG status
- Test deleting unused RAG status
- Test attempting to delete RAG status in use (should fail with error message)
- Test setting RAG status as inactive (should not appear in dropdowns)
- Test updating project RAG status using new lookup
- Test RAG status badges display with correct CSS classes
- Test backward compatibility with existing projects using string
RagStatus
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing AdminController.Phases() actions and Views/Admin/Settings/Phases.cshtml to understand the management pattern. Then trace UpdateRagStatus, Details, _RagTracking.cshtml, CompassDbContext, and service-manual/wwwroot/css/service-manual.css. Done means the lookup-backed admin workflow, migration and seed data, project updates, styling, and backward compatibility satisfy the acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, css, html
- Domain
- database, full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100