Skip to content

Add basic organization switcher

Peter Hegman requested to merge 423116-allow-switching-of-organizations into master

What does this MR do and why?

Related to #423116 (closed)
Designs: #417778 (closed)

The grouptenant scale team is starting to build out an Organization MVC. For more information about what an "Organization" will be see https://docs.gitlab.com/ee/architecture/blueprints/organization/

This MR adds the start of the organization switcher. We do not yet have required routing setup for organizations so it won't actually switch the organization but it will list your available organizations. For now it will always show the Default organization as your current organization. When we complete &11002 (closed) it will allow you to switch organizations and change the route accordingly.

Reviewer notes

  • This switcher does not yet switch organizations. This is because we do not yet have all the backend routing setup for this to work correctly. Routing is being worked on in &11002 (closed) and the switcher will be updated when that is done in #437095
  • Organizations are still in early stage of development so there is still some mock data being used. If the data shown in the UI doesn't make sense it is most likely mock data. We are currently in the process of swapping this mock data out as APIs become available.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

With organizations

Screen_Recording_2024-01-03_at_10.45.38_AM

Empty state

Screenshot_2024-01-03_at_10.47.01_AM

How to set up and validate locally

  1. Open the rails console
    • bin/rails console
  2. Enable the :ui_for_organizations feature flag
    • Feature.enable(:ui_for_organizations)
  3. In the Rails console run the following:
you = User.find_by_username('root')
default_organization = Organizations::Organization.default_organization
Organizations::OrganizationUser.create!(organization_id: default_organization.id, user_id: you.id)

5.times do
   name = FFaker::Company.name
   organization = Organizations::Organization.create(name: name, path: name.parameterize)
   Organizations::OrganizationUser.create!(organization_id: organization.id, user_id: you.id)
end
Edited by Peter Hegman

Merge request reports