RHIDP-12113: Support customization aggregated homepage scorecard card#2609
Conversation
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
ab2ac24 to
7a7fdbe
Compare
Review Summary by QodoSupport customization of aggregated homepage scorecard cards via app-config
WalkthroughsDescription• **New aggregation endpoints**: Implements GET /aggregations/:aggregationId and `GET /aggregations/:aggregationId/metadata` endpoints to support customizable KPI scorecard cards with admin-configurable titles and descriptions via app-config.yaml • **KPI configuration support**: Adds aggregationKPIs configuration section allowing administrators to customize aggregated KPI card metadata (title, description, type, metricId) without code changes • **Backward compatibility**: Maintains support for deprecated metricId prop and `GET /metrics/:metricId/catalog/aggregations` endpoint with RFC 8594 deprecation headers for gradual migration • **Aggregation metadata API**: New metadata-only endpoint for fetching KPI configuration and aggregation type without executing aggregation queries • **Enhanced validation**: Implements middleware-based validation for aggregation IDs and query parameters with configurable length constraints • **Comprehensive testing**: Adds extensive unit tests for new endpoints, hooks, components, and E2E tests covering deprecated, default, and configured aggregation scenarios • **Frontend refactoring**: Updates API client, hooks, and components to use aggregationId parameter with fallback to metricId for backward compatibility • **Improved localization**: Adds translation support for both metric IDs and KPI aggregation IDs with fallback to configured metadata • **Documentation**: Updates backend and frontend README files with new endpoint documentation, configuration examples, and migration guidance Diagramflowchart LR
A["app-config.yaml<br/>aggregationKPIs"] -->|"KPI config"| B["CatalogMetricService<br/>getAggregationConfigs"]
B -->|"config + metric"| C["Mappers<br/>toAggregationMetadata"]
C -->|"metadata"| D["GET /aggregations/:aggregationId<br/>GET /aggregations/:aggregationId/metadata"]
D -->|"aggregationId"| E["ScorecardApiClient<br/>getAggregationMetadata"]
E -->|"metadata"| F["useAggregationMetadata<br/>useTranslatedMetricLabels"]
F -->|"title, description"| G["ScorecardHomepageCard<br/>ErrorStatePanel"]
H["Legacy metricId"] -.->|"fallback"| D
File Changes1. workspaces/scorecard/packages/app-legacy/e2e-tests/scorecard.test.ts
|
Code Review by Qodo
1. Metadata history wrongly required
|
4192a20 to
f007b46
Compare
…cards Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
f007b46 to
2215b4a
Compare
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
|
|
||
| async loginAndSetLocale(locale: string) { | ||
| await this.page.goto('/'); | ||
| await dismissWebpackDevOverlay(this.page); |
There was a problem hiding this comment.
What was the root cause for overlay appearing?
workspaces/scorecard/plugins/scorecard-backend/src/service/CatalogMetricService.ts
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard-backend/src/service/CatalogMetricService.ts
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard-backend/src/service/CatalogMetricService.ts
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard-backend/src/service/router.ts
Outdated
Show resolved
Hide resolved
|
@imykhno When I use |
|
It would be good to display
Backend doesn't validate
@ShiranHi thoughts?
|
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
@ShiranHi Yes, absolutely. We could proceed with the current design for the
@imykhno the message is now much clearer. I would suggest adding Scorecard misconfigured prefix, just because users can have a lot of widgets configured in homepage and this way they can easier identify the issue. "Scorecard misconfigured, aggregation ID (or metric ID) property is not provided" |
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
Eswaraiahsapram
left a comment
There was a problem hiding this comment.
Added a few nit change requests; apart from that, it looks good to me. Thanks @imykhno
workspaces/scorecard/plugins/scorecard/src/hooks/useAggregatedScorecard.tsx
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard/src/hooks/useAggregationMetadata.tsx
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard/src/hooks/useScorecards.tsx
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard/src/hooks/useScorecards.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
…oss multiple languages Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
workspaces/scorecard/plugins/scorecard-backend/src/providers/MetricProvidersRegistry.ts
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard-backend/src/service/CatalogMetricService.ts
Outdated
Show resolved
Hide resolved
workspaces/scorecard/plugins/scorecard-backend/src/service/router.ts
Outdated
Show resolved
Hide resolved
…ission handling Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
Eswaraiahsapram
left a comment
There was a problem hiding this comment.
Thanks @imykhno, for the PR. Tested locally. Looks good to me 🎉
/lgtm
…dling Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
|
New changes are detected. LGTM label has been removed. |
…egation ID Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
|
With latest changes was added:
|
| '@red-hat-developer-hub/backstage-plugin-scorecard-backend': patch | ||
| '@red-hat-developer-hub/backstage-plugin-scorecard-common': patch | ||
| '@red-hat-developer-hub/backstage-plugin-scorecard': patch |
There was a problem hiding this comment.
Sure, I will update changeset to minor
| * @alpha | ||
| */ | ||
| export const scorecardPage = PageBlueprint.make({ | ||
| export const scorecardDrillDownPage = PageBlueprint.make({ |
There was a problem hiding this comment.
It will be inconsistent to have NF page named: scorecardDrillDownPage and in old frontend system named: ScorecardPage. I would suggest that both should have the same name.
There was a problem hiding this comment.
Reverted name to scorecardPage
There was a problem hiding this comment.
Thank you, everything works correctly, only small updates remain and we can merge.
Last question I have is about how should we handle title in drill down page?
I'm thinking the drill down page title should match the title of the aggregation card the user clicked on from the homepage, and that it is also used in the navigation path, for example, "Home -> Custom KPI Title"
Screen.Recording.2026-04-10.at.19.10.42.mov
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
|







Hey, I just made a Pull Request!
This PR lets system administrators customize the
titleanddescriptionshown on aggregated KPI scorecard cards viaapp-config, so Engineering and Product Managers to provide company-specific information, ensuring metrics are easily understood by end-users.Behavior
titleanddescriptionare derived from the metric definition, with the aggregation type set tostatusGroupedby default. Internationalisation (i18n) still applies ifmetric.titleormetric.descriptionare present in the plugin catalogues.app-config.yamlfile. Providingtitle,description, type andmetricIdis required to customize aggregated KPIConfiguration
Customization is not under per-provider plugin keys. It lives under scorecard.aggregationKPIs. (
app-config.yaml). The homepage wires ScorecardHomepageCard (or equivalent) withprops.aggregationIdmatching that key or the metric id for the default case.Example:
API
Responses that include aggregation metadata:
GET /aggregations/:aggregationId;GET /aggregations/:aggregationId/metadata;GET /metrics/:metricId/catalog/aggregations.New logic implemented for:
✔️ Checklist
How to test
1. Aggregated KPI (without changing)
The implemented logic supports the deprecated
metricIdprovided inmountPoints. While this logic is currently maintained to allow users to have aggregated KPIs without changing their configuration, it is scheduled for removal in a future release.metricId. Expected to use the same config as used before;Validate error messages:
2. Aggregated KPI (without default configurations)
The new logic supports the default configuration for aggregated KPI cards. Each provider has a default card information therefore, using the default setup does not require any configuration in the
app-config.yamlfile.aggregationId: 'jira.open_issues'Validate error messages:
3. Aggregated KPI (with customized title and description)
app-config.yamlunder thescorecard.aggregationKPIs. Example:app-config.yamlaggregationKPIs key. Example: aggregationId: 'aggregationKPIs' or aggregationId: 'openIssuesKpi' following the example;Validate error messages:
4. Test the
/metrics/:metricId/catalog/aggregationsendpointThis endpoint is deprecated and scheduled for removal in the next release. However, it remains available for use in the interim.
Get aggregated metric