Make menu items in new navigation sidebar pinnable
What does this MR do and why?
Implementation of #378547 (closed):
- Menu items can be pinned and unpinned.
- Pins can be reorderd.
- Pinned items are stored in a new JSONB database column (in the user_preferences table).
Screenshots or screen recordings
How to set up and validate locally
First enable the feature flag for the new navigation:
Feature.enable(:super_sidebar_nav, User.first)
Then toggle on the New navigation in the top-right user dropdown.
Then perform these (or similar) steps to test the new feature:
- Go to any project or group.
- See the new empty Pinned section in the sidebar.
- Open any section, like Plan, and hover any of its menu items.
- Click the little
📌 button to pin the item. - Find it now in the Pinned section.
- Use it to navigate to that page. See it shown as active. Its original section stays collapsed, so that we don't double-show it.
- Pin a couple more menu items.
- In the Pinned section, hover one of them and drag&drop the little handle-icon on the left to reorder your pins.
- Delete some pins from the Pinned section and see their
📌 icon change also in their original section. - Delete a pin by clicking the
📌 of the orignal item in its section. - Reload the page in between any of these steps to see everything persisted on the backend.
Database
db:migrate
Output of main: == 20230321125300 AddPinnedNavItemsToUserPreference: migrating ================
main: -- add_column(:user_preferences, :pinned_nav_items, :jsonb, {:null=>false, :default=>{}})
main: -> 0.0027s
main: == 20230321125300 AddPinnedNavItemsToUserPreference: migrated (0.0069s) =======
db:rollback
Output of main: == 20230321125300 AddPinnedNavItemsToUserPreference: reverting ================
main: -- remove_column(:user_preferences, :pinned_nav_items, :jsonb, {:null=>false, :default=>{}})
main: -> 0.0012s
main: == 20230321125300 AddPinnedNavItemsToUserPreference: reverted (0.0067s) =======
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Review status
Category | Reviewer | Maintainer |
---|---|---|
backend |
|
|
database |
|
|
frontend |
|
|
test |
|
- |
Edited by Thomas Hutterer