Improve rule editing for package protection settings

What does this MR do and why?

Updates package protection rule feature in project Packages and registries settings to allow rule editing.

Why - #502893 (closed)

Update the protected packages feature to allow in-place rule editing, similar to the functionality planned (https://gitlab.com/gitlab-org/gitlab/-/issues/499871/designs/applied.png) for protected container tags. This enhancement will streamline the user experience and bring consistency across GitLab's protection features.

What

  1. Adding the ability to created & edit package protection rules through a drawer.
  2. Refactors the access level display text by moving the formatting logic to a shared utility function (getAccessLevelLabel).
  3. Updating the form component to handle both creation and updates of protection rules by detecting whether it's being used for a new rule or an existing one.
  4. Added toast messages when rules are created addresses Add toast message when a protection rule is add... (#509170 - closed)
  5. Update the table display to show formatted values and adding edit buttons alongside the existing delete functionality.

Changelog: changed

References

Screenshots or screen recordings

Before After
172.16.123.1_3000_kalcifer_registry-test_-_settings_packages_and_registries Screenshot_2025-03-18_at_1.34.58_pm
Screenshot_2025-03-18_at_1.34.39_pm
Screenshot_2025-03-18_at_1.34.22_pm

How to set up and validate locally

  1. Visit Project > Settings > Packages and registries
  2. Interact with Protected packages feature, should be able to create, edit & delete rules.

MR acceptance checklist

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

Related to #502893 (closed)

Edited by Rahul Chanila

Merge request reports

Loading