Loading
Draft: Modules [skip ci]
What does this MR do and why?
Proof of concept, not for merging. This MR shares the Project Modules prototype so others can try it. It has no specs, docs, translations or feature flag, and the pre-commit and pre-push hooks were skipped.
Project Modules let maintainers extend a project's navigation with external apps, such as GitLab Pages sites, while users stay connected to GitLab.
- Settings → Modules: add, edit, enable or disable, and delete modules. Each module has an icon, name, description, destination, placement and minimum role.
- Destination: either Repo (a project on this instance, resolved to its Pages URL) or URL.
- Placement: either the sidebar's Modules section (which also adds the module to the Feature Library) or a button in a project page's header.
- Launch page (
/:namespace/:project/-/modules/:id): opens the module inside GitLab in a full-height iframe. A floating glass-style header shows:- the GitLab logo
- a way back to the project
- a New work item button, which opens the standard create modal and defaults to the module's source project
- the user menu
- Open in a new tab: an option per module for sites that block embedding. A fallback card appears when the frame is blocked by CSP or doesn't load.
Known limitations
- The iframe may only show the module's own site. Navigating inside the frame to another site shows the fallback card.
- Sites that block framing with
X-Frame-Optionsorframe-ancestorscan't be detected. They show the browser's own error inside the frame. - Signing in to a module through gitlab.com OAuth can't work inside the frame, and the frame's storage is kept separate from the top-level site's.
- The browser URL doesn't follow navigation inside the module. That would need the app to report its route, like Observability's
iframe_navigator.js. - Repo destinations only work for projects on this instance.
- RuboCop offenses left in place:
Migration/EnsureFactoryForTable,Migration/ForeignKeysToDestroyServiceTables,CodeReuse/ActiveRecord(sidebar menu),Gitlab/BoundedContexts(new sidebar files).
References
None yet.
Screenshots or screen recordings
To be added by the author.
| Before | After |
|---|---|
How to set up and validate locally
- Check out the branch and run
bin/rails db:migrate, thengdk restart rspackso the new page bundles load. - As a Maintainer of a project, go to Settings → Modules and add a module. A URL destination such as
https://planner-demo-db56e0.gitlab.io/embeds fine. - Open the module from the sidebar's Modules section. It opens inside GitLab with the floating header.
- Try New work item, the user menu, and the project name button to get back.
- Set a module's placement to a project page (for example Pipelines), and check the button appears in that page's header.
- Tick Open in a new tab on a module, and check it opens the site directly in a new tab.
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.