Skip to content

Improve registry search query params generation

Why?

Improve registry search query params generation inline with behaviour in issues, merge requests pages.

Since the URL generated contains unnecessary query params already, this will look worse as we add one more filter in Filter package registry UI to show packages wit... (#451054 - closed)

The changes affect pages which use the persisted_search component which is package, container, terraform & harbor registry.

What does this MR do?

  • Stops appending query params which are empty
  • Adds shared_examples for packages list filtering
  • Adds assertions for query params for sorting & filtering

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

No change in UI, change in how query parameters are generated

Before After
?type=Generic&version=&orderBy=created_at&sort=desc&search[]=gl&search[]= ?orderBy=created_at&sort=desc&search[]=gl&type=Generic

Related to #462959 (closed)

How to set up and validate locally

  1. Follow steps in https://gitlab.com/gitlab-org/ci-cd/package-stage/package/-/wikis/Packages-Tips-&-Tricks#how-to-create-a-new-package-artificially to publish 10 packages for each package format to a project
  2. Visit the project list page & use the Filter results search bar to filter packages.
  3. Make sure keys for empty query parameters are not added to the URL.

Similar steps can be done for terraform module registry, container registry & harbor registry. They don't have as many filter options as package registry.

Edited by Rahul Chanila

Merge request reports