Skip to content

Refactor split button

Lorenz van Herwaarden requested to merge refactor-split-button into master

What does this MR do and why?

See Improve split_button.vue (#442815 - closed) for more details.

The split_button.vue is used in the finding modal and vulnerability details header. The idea is that if there's only 1 action we show a simple button, and otherwise we show a button group with a dropdown to change the action. This MR moves the logic to distinguish this from the implementer to the split_button.vue itself so we can deduplicate this logic.

Additionally, the actions that are used in multiple places are moved a SSOT in the constants file and the workaround for using the listbox in a button group is removed now that gitlab-ui has received a fix.

Related #442815 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Prerequisites

  1. You need an EE license
  2. You need to have runners enabled (See $2408961 for setting up a runner)
  3. Import https://gitlab.com/gitlab-org/govern/demos/sandbox/minac/test-remediations
  4. Run a pipeline on master

Validate

  1. Go to the last pipeline > security tab.
  2. Click on the only critical finding so the modal appears. A button with listbox should still appear in the bottom right with 3 actions. Close the modal.
  3. On the same page, click on the only low criticality finding so the modal appears. A single button should still appear in the bottom-right to "create issue".
  4. You can test something similar via the vulnerability report > vulnerability details pages. Notice that the low criticality vulnerability will not have the "create issue" button on the details page in the top-right corner because the create issue functionality can be found lower on the page already.
Edited by Lorenz van Herwaarden

Merge request reports