Connect the version detail view to the schema (monolith/S06 plan: 22/22)

What does this MR do and why?

This is Step 22 of 22 of the monolith/S06 "version detail" plan for the GitLab Artifact Registry UI. The Artifact Registry UI is an organization-level Vue application. It sits behind the feature flag artifact_registry_ui. The flag stays disabled, so this MR has no changelog entry.

Before this MR, the version detail page read its version, its files, and its statistics through Apollo @client local resolvers. Those resolvers were backed by a generated mock ladder in graphql/mock_resolvers.js and graphql/mock_artifacts.js. An Apollo @client directive marks a field as resolved locally in the browser, not fetched from the server.

Now the schema owns these reads:

  • The single-version lookup, ArtifactRegistryRepositoryDetails.version(id, artifactId) (added in Step 5).
  • The files connection (added in Step 6, already merged).
  • The statistics field (added in Step 7, the parent MR).

Both query documents, get_version.query.graphql and get_version_files.query.graphql, now select these fields from the server. Neither document has a remaining @client directive. The schema field commitSha is aliased as gitCommitSha, the name the view already reads.

The local Apollo layer now keeps only the manifest read, because the schema does not carry that field yet. This MR deletes the version resolvers, the files paging helpers, the version file ladder, the version typedef extensions, the ArtifactRegistryVersionStatistics and ArtifactRegistryNpmVersionMetadata local types, and the local ArtifactRegistryVersionFile possible-types entry. The files cache type policy stays, because it is a real cache rule, not mock data.

This MR also aligns the Overview tab with the current design:

  • Removes the npm description paragraph and the npmMetadata read, because the design shows no description on the Overview tab.
  • Trims the Overview install panel to the tool selector, the snippet, and the footer help link.
  • Switches the tool selector to the small listbox size.
  • Adds gl-py-5 padding to the tab content.

The Files tab count now comes from the schema's statistics.filesCount. This field is a nullable BigInt, rendered as a string by the schema. The view coerces it to a number and hides the count when Artifact Registry omits it. As before, the count shows for Maven only.

One cost to know about: rendering the Files tab issues two Artifact Registry version REST reads, one per GraphQL operation. The files connection hangs off ArtifactRegistryVersionDetails, which is reachable only through repository.version(id:, artifactId:), so both operations resolve the version. The feature spec asserts that count on purpose.

References

Screenshots or screen recordings

Screenshots are not attached yet. The author will add them. The visible changes are:

  • The trimmed install panel on the Overview tab.
  • The small tool selector.
  • The added tab content padding.
  • The removed npm description paragraph.
Before After

How to set up and validate locally

  1. Enable the flag in a Rails console: Feature.enable(:artifact_registry_ui).
  2. Set up an organization with an active Artifact Registry namespace mapping, and a hosted Maven or npm repository that holds at least one package version. The caproni rig scripts publish-maven-hosted.sh and publish-npm-hosted.sh do this.
  3. Open the version list for the package and click a version. The URL is /o/<organization>/-/artifact_registry/<slug>/repositories/<repository>/<packageId>/versions/<versionId>.
  4. Check that the Overview tab renders the version string, the artifact coordinates, the install snippet, and the sidebar with size and attribution from the server. In the browser network panel, the getArtifactRegistryVersion operation carries statistics { filesCount } and no @client fields.
  5. Open the Files tab. The table lists the version's files with checksums. A second operation, getArtifactRegistryVersionFiles, runs with first: 20.
  6. Reload the page with ?tab=files in the URL. Check that both operations run together.
  7. Run the specs: the fixture spec, the feature spec, and yarn jest ee/spec/frontend/packages_and_registries/artifact_registry.

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.

Edited by Rahul Chanila

Merge request reports

Loading
Loading