Skip to content

Fix component usage counts on list and details pages

What does this MR do and why?

In CI/CD catalog page, we have the list page and details page. Both the usage counts on these pages seem to be incorrect (resource count too high, component count too low). I have spoken to Dov to verify what logic we should use in these counts, see details below. Turns out that in the listing page we do want to count a single project multiple times if that project is using multiple components from a single catalog resource. The only issue left is the time frame that we should count it.

Listing Page requirements (resource usage count):

List page is listing all catalog resources within the catalog. Each catalog resource has a usage count. That count seems to be correct. The way it was counted incorrectly is because is was relying on the the component usage count, that did not narrow the count to the last 30 days as it was supposed to.

How it should be counting
  • Project X uses components A and B → Count = 2
  • Project Y uses only component A → Count = 1
  • Project X uses component A again (same 30-day period) → No additional count
  • Total for catalog resource = 3
  • Only count the usages in the last 30 days.

Details Page requirements (component usage count):

In the details page, we have a list of components that belong to the catalog resource. Each component also has a usage count which is also incorrect. The count was not narrowed down to the last 30 days.

How it should be counting
  • Project X uses Component A on Day 1, Day 5, and Day 15, Day 34
  • Only one usage should be counted in the last 30 days.
  • Only count the usages in the last 30 days. <- this MR is adding this filter.

The reason we thought these values were incorrect as the list page has a value eg 4500 and component usage 4. These logically cant be correct at the same time.

References

Screenshots or screen recordings

Before After

Screenshot 2025-09-23 at 15.59.54.png

Screenshot 2025-09-23 at 16.50.39.png

I would also like to suggest to edit the popovers:

For resource: The number of projects that used a component from this catalog resource in their pipelines in the last 30 days.

(project -> catalog resource)

How to set up and validate locally

  1. Create a usage (via command line) of a component in a project's pipeline that is older then 30 days. Best to modify the usage table:
  2. Verify that the http://127.0.0.1:3000/explore/catalog count should not include that usage.
  3. Verify that the component details page should also not include that usage.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kasia Misirli

Merge request reports

Loading