Skip to content

Adds delete action on package other versions tab

What does this MR do and why?

This MR adds the package version delete functionality on the other versions screen.

It re-uses the shared delete-package-modal component to render the modal.

Why

On the package list page, it's possible to delete a single package via the ellipsis button.

However, on the "other versions" screen (Package Registry > Click on Package > Other version tab), it's not possible to delete a package in this way

Screenshots or screen recordings

state screenshot
vertical ellipsis visible Screenshot_2023-02-21_at_5.03.56_pm
vertical ellipsis expanded Screenshot_2023-02-21_at_5.04.04_pm
shared modal Screenshot_2023-02-21_at_11.44.52_pm
without permission Screenshot_2023-02-21_at_11.45.36_pm

How to set up and validate locally

  1. Publish more than 20 packages with same name & different versions, as mentioned in https://gitlab.com/gitlab-org/ci-cd/package-stage/package/-/wikis/Packages-Tips-&-Tricks#how-to-create-a-list-of-packages-artificially
    1. rails c - Open the rails console

    2. p = Project.find(1) - Find one of your GDK projects. Project id can be found on the project home page

    3. FactoryBot.create_list(:npm_package, 25, project: p, name: p.name) - Creates 25 npm packages

    4. Add this line if above fails during the creation of files

       def fixture_file_upload(*args, **kwargs)
         Rack::Test::UploadedFile.new(*args, **kwargs)
       end
  2. Visit package registry detail page via groups & projects package list page.
  3. Switch to the Other versions tab.
  4. Should be able delete single package by clicking on the ellipsis
  5. Using the bulk delete UI selecting a single package & trying to delete should show the same modal content as deleting a single package
  6. Visit the same URL as user who does not have permission to delete package, should not be able to see ellipsis to delete package.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #382453 (closed)

Edited by Rahul Chanila

Merge request reports