Skip to content

Protected packages: Delete protection rule in project settings ui

What does this MR do and why?

  • Adding button "Delete" for each row containing a protection rule
  • Sending a graphql mutation "deletePackagesProtectionRule" when the button "Delete" is clicked
  • Showing an alert when the graphql mutation fails
  • Adding tests for button 'Delete'

🛠 with at Siemens

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.

MR Checklist (@gerardo-navarro)

Screenshots or screen recordings

I integrated the button "Delete" for each row, similar to the button in the table of protected branches

Screencast: https://www.loom.com/share/de51d65f9e9f437dbd43de5ccdd8a8af

image

image

This is the alert message that is shown when the graphql mutation returns an error, e.g. internal server error, network error, etc.

image

How to set up and validate locally

  1. In rails console enable the experiment fully
Feature.enable(:packages_protected_packages)
  1. Add some package protection rules
15.times { |i| Packages::Protection::Rule.create(project: Project.find_by_full_path('flightjs/Flight'), package_name_pattern: "@flightjs/flight-package-#{i}", package_type: :npm, push_protected_up_to_access_level: :maintainer) }
  1. Go to http://gdk.test:3000/flightjs/Flight/-/settings/packages_and_registries
  2. Start deleting protection rules by clicking the button "Delete"

Related to #413641

Edited by Gerardo Navarro

Merge request reports