Skip to content

Refetch container image tags list after deletion

What does this MR do and why?

Deleting tags in the container registry of a project, the selected tags are deleted, but the UI is not reloaded.

Fix number of tags label after deleting tags (!102940 - merged) attempted to fix this issue in %15.6. However, it introduced a bug which broke filter/sort functionality, resulting in Fix the Container Registry tag filter (!107433 - merged).

While the total count is updated, Fix the Container Registry tag filter (!107433 - merged) re-introduced the issue where the tags list are not refreshed upon deletion. Screenshot_2023-03-15_at_11.20.46_pm

This MR attempts to refresh the list afterwards so that the items just deleted are no longer displayed.

What this MR does

  • Moves logic of deleting tags to tags list component from details page, leading to events being refactored.
  • Moves related tests.
  • Increase test coverage.

Positive side-effects:

  • Fixed alert error where the error message read as 'tags' even when only one item was set to be deleted.
  • Remove unnecessary GraphQL query being refetched.

What this MR does not do

  • Does not attempt to keep current page when tags are deleted.

Screenshots or screen recordings

No change to UI

Before After
Screen_Recording_2023-03-28_at_3.35.20_pm Screen_Recording_2023-03-28_at_3.40.22_pm

How to set up and validate locally

  1. Setup & enable Container Registry https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/registry.md
  2. Add a few images with tags by following https://gitlab.com/gitlab-org/ci-cd/package-stage/package/-/wikis/Packages-Tips-&-Tricks#how-to-add-images-with-tags-quickly-to-the-registry
  3. Alternatively, in the terminal
    $ docker pull hello-world
    $ for i in `seq -f "%02g" 1 30`; do docker tag hello-world 127.0.0.1:5000/<project-path>/hello-world:$i; done
    $ for i in `seq -f "%02g" 1 30`; do docker push 127.0.0.1:5000/<project-path>/hello-world:$i; done
  4. Visit the container registry list page for the project
  5. clicking one of the images should take you the tags list(details) page
  6. Delete one or more tags
  7. Confirm that:
    • tag count at top of page is updated,
    • tag is removed from the list of tags
    • filter/sort still works after deletion
    • clicking on delete image works as expected
    • Visit the container registry list page to confirm that tag is updated there as well.

MR acceptance checklist

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

Fixes #339566 (closed)

Edited by Rahul Chanila

Merge request reports