Add bypass options roles selctor to a police drawer
What does this MR do and why?
This code change adds support for displaying role-based exceptions in a security policy interface. The main addition is a new component called "RolesExceptions" that shows both standard roles (like maintainer, developer) and custom roles in an expandable accordion format.
The component intelligently loads custom role information only when the user expands the accordion section, improving performance. It displays a loading indicator while fetching custom role names from the server, and if the loading fails, it falls back to showing just the role IDs. The interface shows a count of total roles in the accordion header and handles both individual role types and mixed combinations.
The changes also include comprehensive test coverage to ensure the component works correctly in various scenarios - with standard roles only, custom roles only, mixed roles, successful loading, failed loading, and proper accordion interaction behavior.
References
Screenshots or screen recordings
| Description | UI |
|---|---|
| Roles selector in drawer | roles selector.mov |
How to set up and validate locally
Enable feature flag:
Feature.enable(:security_policies_bypass_options)
Feature.enable(:security_policies_bypass_options_group_roles)
- Secure -> Policies
- New merge request approval policy
- Open Advanced settings
- Click add exception button
- Select
rolesoption save roles and custom roles - Save policy and go back to policy list
- Open drawer
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #558885 (closed)