Skip to content

Add search to the context switcher

Paul Gascou-Vaillancourt requested to merge 378541-context-switcher-search into master

What does this MR do and why?

Adds search capability to the context switcher.

This is the first iteration for adding search to the new sidebar. Given that this is all behind a feature flag, we'll be fine-tuning the experience in subsequent MRs to keep the changes as small as possible.

What this does:

  • Tweaks the search box's style to match the designs.
  • Enables the triggering of a GraphQL query to search for projects and groups when text is typed in the search box.
  • Displays the found items in the corresponding list.
  • Shows a no results text in the relevant list when no items could be found.

What this does not do (will be done in upcoming iterations):

  • Auto-focus the search box when opening the context switcher.
  • Loading states.
  • Error states.
  • Collapsible results lists.

Screenshots or screen recordings

Context Preview
Initially, only shows cached items if any Screenshot_2023-03-13_at_2.55.36_PM
On search, shows search results Screenshot_2023-03-13_at_2.57.13_PM
When there are no results, shows empty texts Screenshot_2023-03-13_at_2.57.33_PM

How to set up and validate locally

  1. Enable the new nav:
    1. Enable the feature flag:

      echo "Feature.enable(:super_sidebar_nav)" | rails c
    2. Enable the user setting from the user dropdown:

      Screenshot_2022-12-13_at_1.32.43_PM

  2. In the super sidebar, click on the context title to expand the context switcher.

MR acceptance checklist

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

Related to #378541 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports