Skip to content

boost: Flesh out SummaryCard with category badge, version, source, and lifecycle #4027

Description

@rohitkrai03

Problem

Context: RHIDP-15167 (Entity Page Extensions), task 3.1

The SummaryCard entity card extension (plugins/boost/src/components/catalog/entity/SummaryCard.tsx) currently only renders the entity's metadata.description and spec.rationale fields. The entity-extensions spec requires it to show category badge, current version, source connector, and lifecycle state — the key metadata a developer needs at a glance when landing on an AI asset's entity page.

Expected behavior

The SummaryCard renders a structured summary for any AI asset entity. The card shows:

  1. Category badge — the asset's spec.type rendered as a colored badge using getCategoryMeta() from utils/categoryMeta.ts (label + icon + color already defined for all 7 asset types).
  2. Current version — the rhdh.io/ai-asset-version annotation value, if present. Render as a small badge or chip next to the category.
  3. Source connector — the rhdh.io/ai-asset-source annotation value (e.g. github, model-registry, kagenti). Render as secondary text.
  4. Lifecycle statespec.lifecycle (e.g. production, experimental). Render as a colored badge — production green, experimental amber, all others neutral.
  5. Description — keep existing metadata.description rendering below the metadata row.
  6. Rationale — keep existing spec.rationale rendering as secondary text.

If none of the fields above have values, the card returns null (same as current behavior).

Scope

  • Workspace: workspaces/boost
  • Package: @red-hat-developer-hub/backstage-plugin-boost (plugins/boost)

Files to modify

File Change
plugins/boost/src/components/catalog/entity/SummaryCard.tsx Add category badge using getCategoryMeta(), version badge from rhdh.io/ai-asset-version, source text from rhdh.io/ai-asset-source, lifecycle badge from spec.lifecycle. Keep existing description and rationale rendering. Use BUI Badge, Flex, and Text components.
plugins/boost/src/translations/ref.ts Add i18n keys: catalog.card.summaryCategory, catalog.card.summaryVersion, catalog.card.summarySource, catalog.card.summaryLifecycle, and lifecycle state labels if needed.

New file

File Content
plugins/boost/src/components/catalog/entity/SummaryCard.test.tsx Unit tests (see below).

Implementation details

Reading entity metadata

Use existing utilities — do not create new helpers:

  • getCategoryMeta(specType) from utils/categoryMeta.ts — returns { label, icon, color } for any spec.type. Already handles .toLowerCase() normalization and fallback.
  • getSpecField(entity, 'type') and getSpecField(entity, 'lifecycle') from utils/entityHelpers.ts.
  • entity.metadata.annotations?.['rhdh.io/ai-asset-version'] and entity.metadata.annotations?.['rhdh.io/ai-asset-source'] for annotation values.

Rendering

  • Use BUI Badge with style={{ backgroundColor: meta.color }} for the category badge. Render the category icon from getCategoryMeta() alongside the label.
  • Use BUI Badge size="small" for version (same pattern as current VersionListCard).
  • Lifecycle badge: use Badge with a color variant — green for production, amber/yellow for experimental, neutral/gray for everything else.
  • Source: render as Text variant="body-x-small" color="secondary".
  • All text labels must use i18n keys via useTranslation().
  • Preserve the existing Card / CardHeader / CardBody structure.

Fixture entities for testing

Entity spec.type rhdh.io/ai-asset-version rhdh.io/ai-asset-source spec.lifecycle
code-review-skill skill 1.2.0 github production
granite-3-code ai-model 3.0.1 model-registry production
github-mcp-server mcp-server experimental
web-search-tool ai-tool

Tests

Add SummaryCard.test.tsx following the pattern in AdoptionCard.test.tsx (uses renderInTestApp, EntityProvider, @testing-library/react).

  1. Full metadata — renders category badge, version, source, lifecycle, and description for an entity with all fields populated.
  2. Missing version and source — renders category badge and lifecycle; omits version and source sections.
  3. Category badge uses getCategoryMeta — the badge label and color match the category meta for the entity's spec.type.
  4. Lifecycle badge colorproduction renders green, experimental renders amber.
  5. Empty entity — returns null when description, rationale, and all metadata fields are absent.
  6. Description and rationale preserved — both still render when present (regression check).

Notes

  • The getCategoryMeta utility and CategoryMeta interface already exist and handle all 7 asset types plus a fallback. Do not duplicate this logic.
  • The icon library for category icons is @remixicon/react. Use the icon property from getCategoryMeta() — do not import MUI icons.
  • This card is registered as entity-card:boost/summary in plugin.tsx with the isAiAsset filter. No registration changes needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions