Skip to content

Use category name in UI, and category id in query strings #1836

Description

@holly-cummins

At the moment, the code.quarkus.io UI shows categories which can't be found in the platform's list of categories (such as "artificial-intelligence", rather than "ai" or "Artificial Intelligence"). This is happening because it's exposing the name in the UI, but doing some transformations to make it suitable for use in query strings. It should show the name ("Artificial Intelligence") in the UI, and then use the id in the query string/slug.

This is the pattern extensions.quarkus.io uses*, so it would be good to be consistent. I also think it's most user-friendly. It avoids showing hyphens in the UI, which @cescoffier thought looked a bit awkward. It also ensures everything in the query string maps to a category that we'd want extension authors to be putting into their extension yaml.

  • sort of – extensions.quarkus.io does it's own prettifying mapping, so that also needs to be fixed.

Here's the details of the current behaviour, from Claude:

  1. Extensions like LangChain4j/Bedrock reference "categories": ["ai"] — that's the short id.
  2. Backend Java (QuarkusExtensionUtils.java:62) resolves the id to the full Category object and uses cat.getName(): .category(cat.getName()) // "Artificial Intelligence"
  3. So the REST API sends "category": "Artificial Intelligence" (the human-readable name) to the frontend.
  4. Frontend (extensions-utils.ts:283-285) converts that display name into a URL-friendly slug via catToId():
    function catToId(category?: string): string { return category?.toLowerCase().replace(' ', '-').replace(/\s+.+$/i, ''); }
  5. "Artificial Intelligence" → lowercase → "artificial intelligence" → first space to hyphen → "artificial-intelligence" → regex removes nothing (no remaining whitespace) → "artificial-intelligence"
  6. Search/filter (extensions-utils.ts:28) matches URL queries like category:artificial-intelligence against the catToId-transformed value: {keys: ['category', 'cat'], valueSupplier: e => catToId(e.category)},

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions