Implement organization cluster agents mapping mutations
Issue: Workspaces Cluster Agents Admin Settings UI (#545241 - closed)
What does this MR do and why?
This is step 4 of the work to add Workspaces Agents Availability in the admin settings UI. The crux of this MR is to implement the create and delete organization cluster agent mapping mutation, which also required several refactors:
- Refactored the availability toggle to it's own component, which is also where the mutation gets executed. This allows us to encapsulate all the related mutation logic, such as loading and error handling, within one component.
- I opted to update the
mappedAgentsstore in Apollo Cache instead of refetching queries when the mutation is successful because it results in less unnecessary DB calls and better UX (the entire table does not have to be reloaded). In order to satisfy this, I refactored the existingGetOrganizationWorkspacesClusterAgentsQuerycomponent to watch formappedAgentschanges and to update the organization agent data when this occurs.
References
How to set up and validate locally
- Go to
/rails/features/in the GDK and enable theworkspaces_agents_availability_adminfeature flag. - Create some agents with workspaces enabled in their configuration by following steps 11 and 12 from this documentation.
- Go to
/admin/application_settings/general. - Expand the
Workspaces Agent Availabilitysetting. - See next section for more detailed validation steps
Screenshots or screen recordings
| Screenshot/Recording | Steps |
|---|---|
|
|
|
Generic error:
|
|
|
Mutation error:
|
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.
Edited by Cindy Halim

