Hide Pages deploy job link when the build is gone

What does this MR do and why?

This merge request hides the "Deploy job" link on the project Pages settings page when the deployment has no associated build.

When a PagesDeployment record has no build (the build or pipeline was removed), the ciBuildId field is null. The frontend code tried to render a link using the projectJobPath(projectFullPath, deployment.ciBuildId) route helper. When ciBuildId is null, the helper throws an uncaught ParametersMissing: Route missing required keys: id error.

Before the route-helper migration, the same code joined strings and produced a broken link ending in /-/jobs/undefined. The link was already wrong. The helper only made the defect visible.

The Pages deployment factory in feature specs creates deployments without builds. This caused 20 test examples across 3 spec files to log this error to the browser console.

The fix conditionally renders the "Deploy job" label and link only when deployment.ciBuildId is present. Vue computed properties are lazy, so the route helper is not called when the link is not rendered.

Changes made:

  • app/assets/javascripts/gitlab_pages/components/deployment.vue — render the link with v-if
  • app/assets/javascripts/gitlab_pages/components/live_block.vue — render the label and link with v-if
  • spec/frontend/gitlab_pages/components/deployment_spec.js — added Jest case "deployment has no CI build"
  • spec/frontend/gitlab_pages/components/live_block_spec.js — added Jest case "deployment has no CI build" and passed the required isLoading prop, which removes a pre-existing Vue warning

How to set up and validate locally

  1. Open a Rails console with gdk rails console.
  2. Pick a project with a Pages deployment and clear its build: PagesDeployment.last.update!(ci_build_id: nil).
  3. Open that project's Settings > Pages in the browser.
  4. Open the browser DevTools console.
  5. Check that no ParametersMissing error appears.
  6. Check that the "Deploy job" text is absent for that deployment.

MR acceptance checklist

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

References

  • Addresses one entry of #628901 (browser console error catalogue, section B)
  • Errors surfaced by !255207 (closed) (feature specs fail on console errors)
  • Helper call introduced in commit d95ad48b

🤖 Generated with Claude Code

Merge request reports

Loading
Loading