Skip to content

Make custom role delete modal reusable

What does this MR do and why?

On the Admin Area -> Settings -> Roles and Permissions page, there is a table that shows created custom roles. When Delete role is selected using the triple dot menu for a row, a confirmation modal is shown:

2024-08-02_16-29-06

This MR does the following:

  1. Previously, the delete modal was just the modal itself, and the actual deletion was handled by the parent component. However, we now need to re-use the delete functionality in two places. This MR changes the modal to a reusable component that shows the modal as well as handle the deletion itself, so that the component can be shared in two places.

  2. Previously, the modal would immediately hide when the Delete role button is clicked, and the entire page is shown as loading while it does the deletion and refreshes the table:

2024-08-02_16-45-24

This has been changed so that the modal shows the loading state while the delete is happening, and then the table shows as loading while it's refreshing. The initial load still shows the full-page loading spinner because we don't know at that point whether to show the empty state (no roles created) or the table (at least 1 role created):

2024-08-02_16-53-30

  1. Previously, when there is an error with the query, an error alert is shown, but the empty state component is also shown. To avoid confusion, this MR changes it so that only the error is shown:
Before After
ksnip_20240802-165743 ksnip_20240802-165721
  1. On deletion errors, an error message is shown in the modal:
ksnip_20240802-172731

How to set up and validate locally

See this video (with audio commentary) for validation steps:

2024-08-02_16-33-26

Related to #468386 (closed)

Edited by Daniel Tian

Merge request reports

Loading