Skip to content

Improve custom role create form

Daniel Tian requested to merge 435483-improve-custom-role-create-form into master

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:

  1. The way the baseAccessLevel value is set was made more robust.
  2. Error messages now always show the specific error rather than just the standard message.
  3. refetchQueries was removed, the parent component now refetches the query itself.
  4. The cancel button is now disabled while the mutation is running.

How to set up and validate locally

  1. Set the following environment variable to disable SAAS mode: export GITLAB_SIMULATE_SAAS=0
  2. Go to a top-level group.
  3. Go to Settings -> Roles and Permissions.
  4. Click on Create new role to view the form.

Verify the error message formatting

  1. Fill out the form with anything and click on Create new role.
  2. Verify that you get the following error message:

Failed to create role.

Verify roles are refetched

  1. Set the following environment variable to enable SAAS mode: export GITLAB_SIMULATE_SAAS=1
  2. On the create role form, create a new role.
  3. Verify that the roles list is refetched.

Verify cancel button disabled

  1. On the create role form, fill it out but don't click the button yet.
  2. In DevTools, go to the network tab and change No throttling to Slow 3G.
  3. Click on Create new role. Verify that both the create and cancel buttons are disabled.

Related to #435483 (closed)

Edited by Daniel Tian

Merge request reports

Loading