Improve custom role create form
What does this MR do and why?
On the Roles & Permissions
page, there is a Create new role
form:
This MR makes the following changes:
- The way the
baseAccessLevel
value is set was made more robust. - Error messages now always show the specific error rather than just the standard message.
-
refetchQueries
was removed, the parent component now refetches the query itself. - The cancel button is now disabled while the mutation is running.
How to set up and validate locally
- Set the following environment variable to disable SAAS mode:
export GITLAB_SIMULATE_SAAS=0
- Go to a top-level group.
- Go to
Settings
->Roles and Permissions
. - Click on
Create new role
to view the form.
Verify the error message formatting
- Fill out the form with anything and click on
Create new role
. - Verify that you get the following error message:
Failed to create role.
Verify roles are refetched
- Set the following environment variable to enable SAAS mode:
export GITLAB_SIMULATE_SAAS=1
- On the create role form, create a new role.
- Verify that the roles list is refetched.
Verify cancel button disabled
- On the create role form, fill it out but don't click the button yet.
- In DevTools, go to the network tab and change
No throttling
toSlow 3G
. - Click on
Create new role
. Verify that both the create and cancel buttons are disabled.
Related to #435483 (closed)
Edited by Daniel Tian