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 withv-ifapp/assets/javascripts/gitlab_pages/components/live_block.vue— render the label and link withv-ifspec/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 requiredisLoadingprop, which removes a pre-existing Vue warning
How to set up and validate locally
- Open a Rails console with
gdk rails console. - Pick a project with a Pages deployment and clear its build:
PagesDeployment.last.update!(ci_build_id: nil). - Open that project's Settings > Pages in the browser.
- Open the browser DevTools console.
- Check that no
ParametersMissingerror appears. - 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.
- I have evaluated the MR acceptance checklist for this MR.
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