Sort AI agent inventory card by most relevant agent first

What

Sorts the AI agent inventory dashboard card by usage, so the most-used agent shows first instead of raw API order.

Why

Closes #611949. The card shows only the top few agents, so their order matters and raw API order is arbitrary.

How

Sorts client-side by last30DayUsageCount descending, with a case-insensitive name tiebreak, because aiCatalogConfiguredItems has no sort argument. This adds last30DayUsageCount (a cheap scalar already on AiCatalogItem, "number of projects using the item in the last 30 days") to the existing dashboard agents query. No backend change.

Notes

  • The changes are behind the ai_governance_dashboard feature flag.
  • Sorts a copy of the fetched list, so it does not mutate props or the Apollo cache.

Testing

Query to verify in the GraphQL explorer (https://gitlab.com/-/graphql-explorer):

  1. Step 1: get group id

    {
      group(fullPath: "compliance-group-testing-and-demos") {
        id
      }
    }
  2. Step 2: query

    query {
      aiCatalogConfiguredItems(
        groupId: "gid://gitlab/Group/88055078"
        includeFoundationalConsumers: true
        first: 20
      ) {
        nodes { item { name last30DayUsageCount } }
      }
    }
    
Edited by Dheeraj Joshi

Merge request reports

Loading
Loading