Show dist-tags and gate delete on the version detail page

What does this MR do and why?

This MR adds three changes to the organization-level Artifact Registry UI. Artifact Registry is a GitLab feature that lists packages and container images. It is frontend only (Vue and GraphQL), behind the default-off feature flag artifact_registry_ui. A feature flag is a switch that turns a feature on or off without a new deploy. Because the flag is off by default, this MR has no changelog.

  1. Show npm dist-tags on the version detail page. A dist-tag is a label, like "latest", that points to one npm package version. The version detail page now shows dist-tags as badges in the page header, next to the version name. The versions table already showed them. The GraphQL field distTags on the version already exists (added in GitLab 19.4). The query file get_version.query.graphql now selects this field. Maven versions have no dist-tags, so they show no badges.

  2. Extract a shared TagBadges component. The manifest detail page (for container images) already showed tags in its header. That markup is now a shared component, repositories/components/tag_badges.vue. Both the manifest detail page and the version detail page use it. Behavior does not change: it shows at most 5 badges, truncates names over 32 characters with a tooltip, and puts extra tags behind a "+N more" control that opens a popover. The list has aria-label "Tags" and uses ul/li elements. An empty list renders nothing. Test IDs changed from manifest-tag and similar names to tag-badge, tag-badges, tag-badges-more, and tag-badges-collapsed. The manifest detail feature spec was updated to match. The manifests table (manifests_table.vue) keeps its own tag cell, because it only gets a partial tag preview and a count, not the full list.

  3. Gate the Delete version action on user permission. This closes step 25 of 28 in the artifact delete surface plan. A new query, get_repository_permissions.query.graphql, reads userPermissions { deleteArtifact } on the repository. get_version.query.graphql does not select permissions. The kebab menu shows "Delete version" only when the permissionAllows helper confirms the deleteArtifact permission. Delete version is the only item in that menu. So when the permission is denied, the whole menu and its toggle button do not render. The menu also stays hidden while the permission read is loading, or when it fails or returns no verdict. The delete confirmation closes if the route moves to another version. The delete keeps the repository, artifact, and version ids it started with.

Why the permission has its own query, and what it costs
  • The plan asked the version read to use the cache-and-network fetch policy. A fetch policy tells Apollo when to reuse cached data and when to ask the server again. This policy always asks the server, even when a cached answer exists. On the whole version read, that made the page show its loading skeleton on every revisit.
  • So the version data stays on the cache-first fetch policy. A revisit renders from the cache at once.
  • The permission verdict has its own small query with cache-and-network. It is asked again on every visit. So a permission granted or removed since the last visit shows up without a reload. This meets the plan's re-fetch criterion.
  • Cost, accepted: the page now reads the repository from Artifact Registry twice on a first visit. Once for the version data, once for the permission. The backend caches each request by whether it includes permissions, so one read cannot serve both. On a revisit, the version data comes from the cache, so only the small permission read goes to the network.
  • The server still checks permission on every delete request.

References

Screenshots or screen recordings

The screenshots show an npm version with the dist-tags latest, next, and beta.

Before After
User can delete (menu open) Before: no tag badges, Delete version in the menu After: tag badges in the header, Delete version in the menu
User cannot delete Before: no tag badges, menu toggle still shown After: tag badges in the header, no menu toggle

How to set up and validate locally

  1. Open a Rails console and run Feature.enable(:artifact_registry_ui) to turn on the flag.
  2. Open an organization Artifact Registry npm repository.
  3. Open a package, then open a version that has dist-tags. Check that badges show in the page header.
  4. Open the same version as a user whose repository permission denies deleteArtifact. Check that the kebab menu does not show.
  5. Open the version as a user who is allowed to delete. Check that "Delete version" shows in the kebab menu.
  6. Open a container image manifest. Check that tag badges still render, and that a "+N more" popover shows when there are more than 5 tags.

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.

🤖 Generated with Claude Code

Edited by Rahul Chanila

Merge request reports

Loading
Loading