Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@red-hat-developer-hub/backstage-plugin-scorecard': major
---

**BREAKING**: Graduated the New Frontend System (NFS) scorecard plugin to the stable entry point and simplified NFS feature registration.

- NFS APIs move from `./alpha` to `.`; OFS APIs move to `./legacy` only (not re-exported from the main entry); translations remain at `./alpha`.
- `scorecardCatalogModule` and `scorecardHomeModule` are removed. Entity tab, layout, and homepage widgets are now provided by the default `scorecardPlugin`. Keep only `scorecardTranslationsModule` as a separate app module.
- Extension IDs move from the `catalog` / `home` namespaces to `scorecard` (for example `entity-content:catalog/entity-content-scorecard` → `entity-content:scorecard/entity-content-scorecard`). Update any `app.extensions` config accordingly. See the plugin README migration notes.
2 changes: 1 addition & 1 deletion workspaces/scorecard/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ app:
path: /

# Scorecard tab: entity shows tab if it matches any filter below.
- entity-content:catalog/entity-content-scorecard:
- entity-content:scorecard/entity-content-scorecard:
config:
allowedFilters:
- kind: component # e.g. Component with spec.type: website
Expand Down
4 changes: 2 additions & 2 deletions workspaces/scorecard/packages/app-legacy/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
import { RequirePermission } from '@backstage/plugin-permission-react';
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
import { scorecardTranslations } from '@red-hat-developer-hub/backstage-plugin-scorecard/alpha';
import { githubAuthApiRef } from '@backstage/core-plugin-api';
import { getThemes } from '@red-hat-developer-hub/backstage-plugin-theme';
import {
Expand All @@ -60,7 +59,8 @@ import {
ScorecardErrorStatusIcon,
ScorecardSuccessStatusIcon,
ScorecardWarningStatusIcon,
} from '@red-hat-developer-hub/backstage-plugin-scorecard';
scorecardTranslations,
} from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';

import { ScalprumContext, ScalprumState } from '@scalprum/react-core';
import { PluginStore } from '@openshift/dynamic-plugin-sdk';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import {
EntityKubernetesContent,
isKubernetesAvailable,
} from '@backstage/plugin-kubernetes';
import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard';
import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';

import { GithubIssuesCard } from '@backstage-community/plugin-github-issues';
import { EntityGithubPullRequestsContent } from '@roadiehq/backstage-plugin-github-pull-requests';
Expand Down
6 changes: 1 addition & 5 deletions workspaces/scorecard/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ import {
homepageTranslationsModule,
} from '@red-hat-developer-hub/backstage-plugin-dynamic-home-page/alpha';
import scorecardPlugin, {
scorecardHomeModule,
scorecardTranslationsModule,
scorecardCatalogModule,
} from '@red-hat-developer-hub/backstage-plugin-scorecard/alpha';
} from '@red-hat-developer-hub/backstage-plugin-scorecard';
import { signInModule } from './modules/signIn';
import { navModule } from './modules/nav';
import { iconsModule } from './modules/icons';
Expand All @@ -39,8 +37,6 @@ const app = createApp({
homePageModule,
homepageTranslationsModule,
scorecardPlugin,
scorecardHomeModule,
scorecardCatalogModule,
scorecardTranslationsModule,
iconsModule,
signInModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ScorecardErrorStatusIcon,
ScorecardSuccessStatusIcon,
ScorecardWarningStatusIcon,
} from '@red-hat-developer-hub/backstage-plugin-scorecard';
} from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';

export const iconsModule = createFrontendModule({
pluginId: 'app',
Expand Down
136 changes: 102 additions & 34 deletions workspaces/scorecard/plugins/scorecard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

The Scorecard plugin provides a configurable framework to visualize Key Performance Indicators (KPIs) in Backstage. This frontend plugin integrates with the Scorecard backend to deliver Scorecards.

The plugin supports both the **legacy** Backstage frontend and the **New Frontend System (NFS)**. Use the main package for legacy apps and the `/alpha` export for NFS apps. For NFS, the plugin currently provides three modules: a catalog module for the Scorecard entity tab, a home module for homepage widgets, and a translations module.
The plugin supports both the **legacy** Backstage frontend and the **New Frontend System (NFS)**. NFS is the primary package entry point. OFS (legacy) exports are available only at `./legacy`. Translations remain available at `./alpha`.

For NFS, register the default `scorecardPlugin` plus `scorecardTranslationsModule`. The plugin itself contributes the Scorecard page, entity tab, layout, and homepage widgets (no separate catalog/home modules).

**Features:**

- **Entity scorecard tab** — View scorecard metrics on catalog entity pages (components, websites, etc.).
Expand Down Expand Up @@ -44,21 +47,18 @@ yarn workspace app-legacy add @red-hat-developer-hub/backstage-plugin-scorecard
yarn workspace app add @red-hat-developer-hub/backstage-plugin-scorecard
```

2. Register the plugin in `packages/app/src/App.tsx` using the **alpha** export:
2. Register the plugin in `packages/app/src/App.tsx`:

```tsx
// In packages/app/src/App.tsx
import { createApp } from '@backstage/frontend-defaults';
import {
scorecardHomeModule,
import scorecardPlugin, {
scorecardTranslationsModule,
scorecardCatalogModule,
} from '@red-hat-developer-hub/backstage-plugin-scorecard/alpha';
} from '@red-hat-developer-hub/backstage-plugin-scorecard';

const app = createApp({
features: [
scorecardHomeModule,
scorecardCatalogModule,
scorecardPlugin,
scorecardTranslationsModule,
// ... other plugins
],
Expand All @@ -72,7 +72,7 @@ yarn workspace app-legacy add @red-hat-developer-hub/backstage-plugin-scorecard
```yaml
app:
extensions:
- entity-content:catalog/entity-content-scorecard:
- entity-content:scorecard/entity-content-scorecard:
config:
allowedFilters:
- kind: component
Expand Down Expand Up @@ -128,7 +128,7 @@ To align with the legacy EntityPage (Scorecard on component pages and default en
```yaml
app:
extensions:
- scorecard-layout:catalog/scorecard-entity-layout-grid:
- scorecard-layout:scorecard/scorecard-entity-layout-grid:
config:
groups:
codeQuality:
Expand Down Expand Up @@ -162,7 +162,7 @@ To align with the legacy EntityPage (Scorecard on component pages and default en
- If `groups` is empty or omitted, the grid layout falls back to the default `EntityScorecardContent` view (individual cards for all metrics).
- When multiple layout extensions are enabled, the Scorecard tab renders a toggle to switch between them.

7. (Optional) Enable homepage Scorecard widgets by adding `scorecardHomeModule` to app features (see step 2) and configuring home page extensions in `app-config.yaml`:
7. (Optional) Enable homepage Scorecard widgets by configuring home page extensions in `app-config.yaml` (widgets are registered by `scorecardPlugin`):

```yaml
app:
Expand Down Expand Up @@ -255,28 +255,96 @@ To align with the legacy EntityPage (Scorecard on component pages and default en

##### Modules and extensions (NFS)

The following modules and extensions are available from `@red-hat-developer-hub/backstage-plugin-scorecard/alpha` for NFS apps:
The following modules and extensions are available from `@red-hat-developer-hub/backstage-plugin-scorecard` for NFS apps:

**Modules**

| Module | Description |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scorecardHomeModule` | Registers Scorecard homepage widgets for the home plugin (`AggregatedCardWithDeprecatedMetricId`, `AggregatedCardWithDefaultAggregation`, `AggregatedCardWithJiraOpenIssues`, `AggregatedCardWithGithubOpenPrs`, `AggregatedCardWithGithubFilecheckLicense`, `AggregatedCardWithGithubFilecheckCodeowners` and `AggregatedCardWithGithubOpenPrsWeighted`). |
| `scorecardCatalogModule` | Registers the Scorecard entity tab and the grid layout extension with the catalog plugin. Add to your app's `features`. Which entities show the tab is configured via `app.extensions` (see step 3). The grid layout is disabled by default; enable and configure it with `groups` (see step 6). |
| `scorecardTranslationsModule` | Registers Scorecard translations with the app. Add to your app's `features`. |

**Extensions**

- `api:scorecard` — Scorecard API (provided by the plugin; auto-discovered when the plugin is installed).
- `entity-content:catalog/entity-content-scorecard` — Scorecard tab on catalog entity pages. Configure with `allowedFilters` in `app.extensions` to limit by kind and optionally type.
- `scorecard-layout:catalog/scorecard-entity-layout-grid` — Grid layout with metric group cards (disabled by default). Enable via `app.extensions` and define `groups` to organize metrics into themed cards (see step 6).
- `home-page-widget:home/scorecard-deprecated-metric-id` — Homepage widget using deprecated metricId property (Jira open issues).
- `home-page-widget:home/scorecard-default-aggregation` — Homepage widget using default aggregation config (GitHub open PRs).
- `home-page-widget:home/scorecard-jira-open-issues` — Homepage widget showing Jira open blocking tickets.
- `home-page-widget:home/scorecard-github-open-prs` — Homepage widget showing GitHub open PRs.
- `home-page-widget:home/scorecard-github-filecheck-license` - Homepage widget showing file check "License".
- `home-page-widget:home/scorecard-github-filecheck-codeowners` - Homepage widget showing file check "Codeowners".
- `home-page-widget:home/scorecard-github-open-prs-weighted` - Homepage widget showing weighted status score for GitHub open PRs.
| Module | Description |
| ----------------------------- | ---------------------------------------------------------------------------- |
| `scorecardTranslationsModule` | Registers Scorecard translations with the app. Add to your app's `features`. |

The default `scorecardPlugin` registers the Scorecard page, API, entity tab, layout, and homepage widgets.

**Extension IDs**

| Extension ID | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `api:scorecard` | Scorecard API (auto-discovered when the plugin is installed). |
| `page:scorecard` | Scorecard entities / drill-down page. |
| `entity-content:scorecard/entity-content-scorecard` | Scorecard tab on catalog entity pages. Configure with `allowedFilters` in `app.extensions` to limit by kind and optionally type. |
| `scorecard-layout:scorecard/scorecard-entity-layout-grid` | Grid layout with metric group cards (disabled by default). Enable via `app.extensions` and define `groups` (see step 6). |
| `home-page-widget:scorecard/scorecard-deprecated-metric-id` | Homepage widget using deprecated `metricId` (Jira open issues). |
| `home-page-widget:scorecard/scorecard-default-aggregation` | Homepage widget using default aggregation (GitHub open PRs). |
| `home-page-widget:scorecard/scorecard-jira-open-issues` | Homepage widget for Jira open blocking tickets. |
| `home-page-widget:scorecard/scorecard-github-open-prs` | Homepage widget for GitHub open PRs. |
| `home-page-widget:scorecard/scorecard-github-filecheck-license` | Homepage widget for file check "License". |
| `home-page-widget:scorecard/scorecard-github-filecheck-codeowners` | Homepage widget for file check "Codeowners". |
| `home-page-widget:scorecard/scorecard-github-open-prs-weighted` | Homepage widget for weighted GitHub open PRs health. |

##### Migration notes (NFS graduation)

If you previously imported Scorecard NFS APIs from `/alpha` and registered separate catalog/home modules, update as follows.

**1. Features registration**

```diff
- import scorecardPlugin, {
- scorecardCatalogModule,
- scorecardHomeModule,
- scorecardTranslationsModule,
- } from '@red-hat-developer-hub/backstage-plugin-scorecard/alpha';
+ import scorecardPlugin, {
+ scorecardTranslationsModule,
+ } from '@red-hat-developer-hub/backstage-plugin-scorecard';

features: [
scorecardPlugin,
- scorecardCatalogModule,
- scorecardHomeModule,
scorecardTranslationsModule,
]
```

`scorecardCatalogModule` and `scorecardHomeModule` are removed. Entity tab and homepage widgets are provided by `scorecardPlugin` directly.

**2. `app.extensions` IDs**

Extension IDs now use the `scorecard` plugin namespace (not `catalog` / `home`):

| Old ID | New ID |
| ------------------------------------------------------------- | ------------------------------------------------------------------ |
| `entity-content:catalog/entity-content-scorecard` | `entity-content:scorecard/entity-content-scorecard` |
| `scorecard-layout:catalog/scorecard-entity-layout-grid` | `scorecard-layout:scorecard/scorecard-entity-layout-grid` |
| `home-page-widget:home/scorecard-deprecated-metric-id` | `home-page-widget:scorecard/scorecard-deprecated-metric-id` |
| `home-page-widget:home/scorecard-default-aggregation` | `home-page-widget:scorecard/scorecard-default-aggregation` |
| `home-page-widget:home/scorecard-jira-open-issues` | `home-page-widget:scorecard/scorecard-jira-open-issues` |
| `home-page-widget:home/scorecard-github-open-prs` | `home-page-widget:scorecard/scorecard-github-open-prs` |
| `home-page-widget:home/scorecard-github-filecheck-license` | `home-page-widget:scorecard/scorecard-github-filecheck-license` |
| `home-page-widget:home/scorecard-github-filecheck-codeowners` | `home-page-widget:scorecard/scorecard-github-filecheck-codeowners` |
| `home-page-widget:home/scorecard-github-open-prs-weighted` | `home-page-widget:scorecard/scorecard-github-open-prs-weighted` |

Example:

```diff
app:
extensions:
- - entity-content:catalog/entity-content-scorecard:
+ - entity-content:scorecard/entity-content-scorecard:
config:
allowedFilters:
- kind: component
```

Homepage widget **layout** config under `home-page-layout:home/dynamic-homepage-layout` (widget names like `AggregatedCardWithGithubOpenPrs`) is unchanged; only the extension IDs above move namespaces.

**3. Legacy (OFS) imports**

OFS components, the OFS plugin, and status icons are available only from `./legacy` (not re-exported from the main entry):

```diff
- import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard';
+ import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';
```

#### Legacy app

Expand All @@ -289,7 +357,7 @@ The following modules and extensions are available from `@red-hat-developer-hub/
2. Add the Scorecard tab to the entity overview in `packages/app-legacy/src/components/catalog/EntityPage.tsx` (or your legacy app's equivalent):

```tsx
import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard';
import { EntityScorecardContent } from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';

const scorecardRoute = (
<EntityLayout.Route path="/scorecard" title="Scorecard">
Expand Down Expand Up @@ -334,7 +402,7 @@ The following modules and extensions are available from `@red-hat-developer-hub/
3. (Optional) Add Scorecard homepage cards to your home page:

```tsx
import { ScorecardHomepageCard } from '@red-hat-developer-hub/backstage-plugin-scorecard';
import { ScorecardHomepageCard } from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';

// GitHub open PRs
<ScorecardHomepageCard metricId="github.openPRs" />
Expand Down Expand Up @@ -378,7 +446,7 @@ permission:

### Homepage scorecard cards

The plugin exports **`ScorecardHomepageCard`** (see [`plugin.ts`](./src/plugin.ts)) for use on customizable home pages (for example **Dynamic Home Page** mount points such as `home.page/cards`).
The plugin exports **`ScorecardHomepageCard`** from `@red-hat-developer-hub/backstage-plugin-scorecard/legacy` (see [`plugin.ts`](./src/plugin.ts)) for use on customizable home pages (for example **Dynamic Home Page** mount points such as `home.page/cards`).

#### Backend configuration

Expand Down Expand Up @@ -409,7 +477,7 @@ The supported model is **a single `aggregationId` string** whose value is either
Example (Dynamic Home Page–style mount point): register **`ScorecardHomepageCard`** and pass **`props.aggregationId`** (and **`metricId`** only if you still run an older card API):

```tsx
import { ScorecardHomepageCard } from '@red-hat-developer-hub/backstage-plugin-scorecard';
import { ScorecardHomepageCard } from '@red-hat-developer-hub/backstage-plugin-scorecard/legacy';
import { ComponentType } from 'react';

// Inside your home page cards config:
Expand Down
8 changes: 1 addition & 7 deletions workspaces/scorecard/plugins/scorecard/dev/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ import {
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { rhdhThemeModule } from '@red-hat-developer-hub/backstage-plugin-theme/alpha';

import scorecardPlugin, {
scorecardCatalogModule,
scorecardHomeModule,
scorecardTranslationsModule,
} from '../src/alpha';
import scorecardPlugin, { scorecardTranslationsModule } from '../src';
import { scorecardApiRef } from '../src/api';

import { MockScorecardApi, mockCatalogApi } from './mocks';
Expand Down Expand Up @@ -145,8 +141,6 @@ const app = createApp({
features: [
devNavModule,
scorecardPlugin,
scorecardCatalogModule,
scorecardHomeModule,
scorecardTranslationsModule,
appDevModule,
catalogDevModule,
Expand Down
Loading
Loading