Update package registry list to show accurate number of error packages
What does this MR do and why?
Context
As part of Filter package registry UI to show packages wit... (#451054 - closed) we updated the error package alert to show the number of error packages & add a link to the packages page with error status filter.
This was a MVC implementation which computes this number based on the current page results. This is not accurate since we don't know the errored packages from all the pages.
Implementation
- Adds new graphql query to request for packages with error status.
- Updates
PackageErrorsCountto use graphql query. - Render errors count component above search component as per design
- Update error packages href to ignore existing filters since the component does not exist within the search context anymore.
Noticed that the default error message when there is only one package does not match the message in the package list entry. I've updated the text so that the Delete this package and try again text shows up regardless of error message.
Changelog: added
Closes #460583 (closed)
References
Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Part 1: Extract package errors alert to separate component (!169862 - merged)
- Part 2: Refactors package errors count component (!170748 - merged)
- Part 3: This MR.
Reference to all possible error messages: !122299 (merged)
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
| Before | After |
|---|---|
![]() |
![]() |
![]() |
![]() |
How to set up and validate locally
- On your rails console
bundle exec rails cdef fixture_file_upload(*args, **kwargs) Rack::Test::UploadedFile.new(*args, **kwargs) end- Find the project where you want to work with the package registry
p = Project.find(<project_id>) - Create 10 packages:
FactoryBot.create_list(:npm_package, 10, project: p)
- Go to the package registry using the sidebar or via the URL
<hostname>/<project>/-/packages& visit the package detail page - Back in your rails console Update the status of one package to
ERRORPackages::Package.find(<package-id-from-details-page-url>).update(status: :error) - Re-visit the list page & you should be able to see the error alert with alert message for only one package.
- Clicking on the button should show the confirmation to delete the package.
- Back in your rails console Update the status of two packages to
ERROR - Re-visit the list page & you should be able to see the error alert with alert message for only multiple packages.
- Clicking on the button redirect to the list page with
Statusfilter set toError
- Clicking on the button redirect to the list page with
Other verification
- Verify that list page with
Statusfilter set toErrordoes not show the error alert message. - On the list page with
Statusfilter set, change the query param value to uppercase & confirm the page filters by status correctly. - Trying updating the status message for one of the error packages using
.update(status_message: 'custom error message')& make sure the custom error message shows up.



