Mount GitLab Apps from the layout with pipeline context
What does this merge request do and why?
Stacked on !268731 (merged). Retarget to master once that merges.
GitLab Apps are now mounted from the layout instead of from each page's own Vue app, and the pipeline app link carries gl_project_path and gl_pipeline_id so the app opens on the right pipeline.
- A layout-level helper (
GitlabAppsHelper) decides which mount points the current page offers and what context each one passes. Only the pipeline page is wired up for now, hardcoded. - The layout renders the resulting apps as JSON on
#js-gitlab-apps, only when there is at least one app. - Pages expose empty
.js-gitlab-app-mountpoint[data-mount-point]placeholders. The pipeline header now has one in its panel actions. main_ee.jslazy-loads a small script that mounts anAppLinkinto each placeholder, including placeholders that a Vue app renders after page load.
Why mount from the layout
Passing apps through each page's helper (for example js_pipeline_header_data) means a new helper and a new provide for every place an app can appear. With a single layout helper and placeholders, adding a mount point is one placeholder element plus one context entry, and page components don't need to know about apps. A MutationObserver covers placeholders that Vue renders late, such as portal targets.
The context is built from the resources the controller has already loaded and authorized (@project, @pipeline), not from params. How to generalise the per-page context mapping is tracked in the design doc.
References
- https://gitlab.com/groups/gitlab-org/-/work_items/24271
- https://gitlab.com/gitlab-org/gitlab/-/work_items/636866
- !268731 (merged)
Screenshots or screen recordings
| Before | After |
|---|---|
Both open the Pipeline Visualizer in a new tab. Before, the link carries no context. After, it carries gl_pipeline_id and gl_project_path. The caption bar is an overlay added for the recording.
How to set up and validate locally
- Enable the flag for a group:
Feature.enable(:gitlab_apps, Group.find_by_full_path('<group>')). - Open a pipeline in a project in that group.
- Check that the Pipeline Visualizer button's link includes
gl_project_pathandgl_pipeline_id. - Check that
#js-gitlab-appsis only present on pipeline pages.
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.