Derive the artifact registry document title in the app shell

What does this MR do and why?

This change is behind the feature flag :artifact_registry_ui

router.afterEach(updateDocumentTitle()) pushed the document title on navigation. It fires once, synchronously, so it can only render what is knowable the instant a route is entered.

That is enough for every route the artifact registry SPA has today, because each one is named by its own URL segment or by static route meta. It stops being enough as soon as a page is named by something read after the navigation that opened it — which the version list will be, since Artifact Registry addresses an artifact by an opaque id rather than by name.

So the shell derives the title instead of a hook pushing it. This is the shape explore/analytics_dashboards already uses, for the same reason — its own comment reads "A router hook would fire before the asynchronous dashboard name arrives."

No behaviour changes. Every route titles exactly as it did.

Changes

  • buildDocumentTitle replaces updateDocumentTitle: pure, taking the route and the base title, rather than building a hook that assigns.
  • app.vue captures the Rails-rendered title as its base, derives the title in a computed, and assigns it from an immediate watcher.
  • routeName is extracted so the breadcrumb trail and the document title share one rule and cannot disagree about what a page is called.
  • The router no longer registers an afterEach, and no longer imports from utils.
  • The title tests move from the router spec to the shell that now owns them, and the repository detail spec drops the title assertion it could only make because a hook was doing the work.

Screenshots or screen recordings

No visible change. The document title and breadcrumb trail render identically on every route.

How to set up and validate locally

  1. Enable the flag: Feature.enable(:artifact_registry_ui).
  2. Visit /o/<organization>/-/artifact_registry/acme/repositories.
  3. Open a repository, then its Edit form.
  4. Confirm the browser tab title reads as it does on master:
    • list → Repositories · <org> · GitLab
    • detail → <repository> · Repositories · <org> · GitLab
    • edit → Edit hosted repository · <repository> · Repositories · <org> · GitLab

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.

Merge request reports

Loading
Loading