Skip to content

Super sidebar: Replace a placeholder when adding menu items

Lukas Eipert requested to merge leipert-project-super-sidebar-new-menus into master

What does this MR do and why?

Super sidebar: Replace a placeholder when adding menu items

In the first iteration of our super sidebar menus, we used a property on the menu items in order to control where they are inserted. The property super_sidebar_before: :foo is used to insert the current menu item before the menu item :foo.

In practice this has proven to be a little difficult for a few reasons:

  1. The CE/EE split makes it hard to predict where exactly an item will be, because depending on CE / EE the order of items might be different, as the EE version might inject items somewhere in the middle.
  2. In the Super Sidebar we are pulling items from many different other menus into another menu. Now this also depends on the order these menus have been added to the original Panel
  3. A recent change in our requirements, also wants us to reorder a few elements inside the panels and I assume that we want to reorder items more easily in the future.

So the idea is that for the Super Sidebar we just create an array of NilMenuItem and let them have the same item_id as the real items. These placeholders are then going to be replaced with the real item during the transform_old_menus conversion. In case no placeholder was defined, the real item is just appended to the end of the list.

This technique will render super_sidebar_before obsolete, and the plan is to remove it once all menus are using the new technique.

Add new super sidebar menus for projects

As of now these menus are dummy menus which are mostly not rendered, as they have no menu items. The reason why we introduce them all within this commit: It will make it easier to have parallel MRs which actually utilize the new menus, resulting in less conflicts (e.g. translations, etc.)

Screenshots or screen recordings

The order changed slightly (Operations renamed to "Operate") and moved ahead of the "old" menu items.

Screenshot_2023-03-29_at_10.14.03

We will move all the menu items into their respective new menus and this will correct the order soon.

Related to #393190

How to set up and validate locally

  1. Enable the super_sidebar_nav feature flag.
  2. Log into the GDK and enable the New Navigation for the current user via the User Menu
  3. Go to any project

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lukas Eipert

Merge request reports