Add dropdown to Projects nav item
What does this MR do?
Adds a dropdown menu to Projects on navigation
Why was this MR needed?
This MR enables easier access to items related to projects which otherwise involved multiple clicks.
How do we determine list of frequently accessed projects?
localStorage
based on following scenarios;
A project is logged in list of frequent projects within - When a project is visited for first time, we log it with
frequency
set to1
&lastAccessedOn
set to current timestamp. - If same project is visited more than once in an hour, both
frequency
&lastAccessedOn
remain unchanged. - If same project is visited more than once over duration of more than an hour,
frequency
is increased by1
andlastAccessedOn
is updated with current timestamp. - At the most, we keep 20 such visited projects in storage.
Top 5 frequent projects are retrieved based on following filters from storage;
- Sort entire collection of stored projects list in descending order of
frequency
(highest to lowest) and then bylastAccessedOn
(recent most to oldest) - Filter the sorted collection based on
frequency
higher than 3. - Return first 5 projects from this filtered collection and show on dropdown.
Notes:
- This feature entirely depends on availability
localStorage
. - This feature is only available to logged-in users (projects dropdown is not shown for guests).
- A list of frequent projects is limited to browser, user can't access his/her frequent projects by logging in to a new browser (as the list is stored locally within browser).
- This list of projects is unique to user, if user A logs out and user B logs in within same browsers, frequent projects of user A are not shown to user B, vice versa is also true.
- Once a project is part of frequents list, if anything about project changes; like name, namespace, path or avatar, it will not be reflected in the list until project page is visited. This is a known limitation.
- It is worth noting here that in case project path has changed (due to change in name or namespace), entry in dropdown will still point to old URL, which can lead to
404
, so it is suggested to visit project once using new URL to update the list entry.
Screenshots
Desktop View
Default (without Frequent projects available)
With Frequent Projects
localStorage
is unavailable
If
Loading Search Results
Search Results
No Results for Search
Failure while performing search
Mobile View
Default
With Frequent Projects
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary [ ] Documentation created/updated-
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend [ ] Has been reviewed by Backend[ ] Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together
What are the relevant issue numbers?
Closes #35010 (closed)
Edited by Filipa Lacerda