Add single repository Vue app mount behind a feature flag

What does this MR do and why?

Beginning of gitlab-org#23817. This MR adds:

  • The repository_single_vue_app wip feature flag (project actor, default off)
  • TreeHelper#repository_single_vue_app_enabled?(project), the one flag check shared by both views.
  • TreeHelper#vue_repository_app_data(project, repository, ref, ref_type, blob: nil). It builds one payload from the existing building blocks and outputs each value once.
  • projects/_repository_app.html.haml, which renders only #js-repository-app with a loading icon. _files.html.haml and blob/show.html.haml render it when the flag is on. #js-file-browser and its 320px reserved width stay where they are, to avoid layout shift.

Some notes for reviewers:

  • spec/spec_helper.rb turns the flag off by default. The frontend doesn't read #js-repository-app yet (#630951 (closed)), so leaving it on would break the existing repository feature specs and frontend fixtures. Specs that need the flag on turn it on explicitly.

References

Screenshots or screen recordings

Not applicable. When the flag is on, the page shows a loading icon in the repository region until the frontend from #630951 (closed) lands.

Before After

How to set up and validate locally

  1. In a Rails console, run Feature.enable(:repository_single_vue_app, Project.find_by_full_path('<path>')).
  2. Open a tree page and a blob page of that project. In the page source, check that #js-repository-app is rendered with its data-* attributes, and that #js-tree-list, #js-view-blob-app and #js-repository-blob-header-app are not.
  3. Run Feature.disable(:repository_single_vue_app) and check that the legacy mount points come back.

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.

Edited by Chaoyue Zhao

Merge request reports

Loading
Loading