Repository navigation
fix(grafana): expose card table options as extension config in the New Frontend System - #11121
MatheusMartinho wants to merge 3 commits into
Conversation
Changed Packages
|
…w Frontend System In the New Frontend System the alerts and dashboards cards were registered with EntityCardBlueprint.make and rendered the components with no props, so every table option (paged, searchable, pageSize, sortable, title, and for alerts showState) was stuck at its default. The alerts card never showed its State column, and there was no way to change any of it from config. Both cards now use makeWithOverrides with a configSchema, the pattern the jenkins, github-actions and entity-feedback workspaces already use, and spread the config into the component. additionalDashboards is a function and cannot come from config, so it stays a prop of the legacy component; the docs say so. Without config the cards render exactly as before. Fixes backstage#10991 Signed-off-by: MatheusMartinho <[email protected]>
3c52fc4 to
5e9d376
Compare
The report records package.json positions of the two devDependencies knip already flagged as unused; adding zod one line above them shifted those positions, and CI checks the report byte for byte. Signed-off-by: MatheusMartinho <[email protected]>
Signed-off-by: Matheus Moura Martinho <[email protected]>
|
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
|
Any plans to merge the Fix which addresses : #11121 (comment)? Four your kind attention: @Parsifal-M for reveiw. |
awanlin
left a comment
There was a problem hiding this comment.
Hi @MatheusMartinho, this looks pretty solid but there's a merge conflict, can you fix that please?
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the Grafana entity-card configuration changes.
No open issues 🎉
What changed in this PR
Addresses #10991 by exposing Grafana entity-card options through New Frontend System configuration, including the alerts card’s State column, while preserving defaults and legacy component props.
Changes:
- Adds optional configuration schemas and passes configured values to both cards.
- Adds tests for custom titles and alert-state visibility, plus configuration examples.
- Adds Zod, a patch changeset, and updated generated reports.
| File | Description |
|---|---|
workspaces/grafana/yarn.lock |
Records the plugin’s Zod dependency. |
workspaces/grafana/plugins/grafana/src/alpha/entityCards.tsx |
Exposes configuration options for both entity cards. |
workspaces/grafana/plugins/grafana/src/alpha/entityCards.test.tsx |
Tests custom titles and the State column. |
workspaces/grafana/plugins/grafana/report-alpha.api.md |
Updates public types for card configuration. |
workspaces/grafana/plugins/grafana/package.json |
Adds Zod for configuration schemas. |
workspaces/grafana/plugins/grafana/knip-report.md |
Refreshes dependency-report line references. |
workspaces/grafana/plugins/grafana/docs/dashboards-on-component-page.md |
Documents dashboard options and defaults. |
workspaces/grafana/plugins/grafana/docs/alerts-on-component-page.md |
Documents alert options, including showState. |
workspaces/grafana/.changeset/grafana-nfs-card-config.md |
Adds a patch release note for configurable cards. |
Review effort: Balanced
Fixes #10991.
What the bug was
In the New Frontend System the Grafana entity cards were registered with
EntityCardBlueprint.makeand rendered<m.AlertsCard />/<m.DashboardsCard />with no props. The components take their table options as props (AlertsCardOpts/DashboardCardOpts), so on NFS every option was stuck at its default — the alerts card never showed itsStatecolumn, and neither card'stitle,paged,pageSize,searchableorsortablecould be set. As @awanlin noted on the issue, there was no way to pass them through NFS config at all.What this does
Both cards now use
EntityCardBlueprint.makeWithOverrideswith aconfigSchema, following the pattern already used by the jenkins, github-actions and entity-feedback workspaces, and spread the config into the component:Exposed keys — all optional, omitting one keeps the component default:
entity-card:grafana/alertspaged,searchable,pageSize,sortable,title,showStateentity-card:grafana/dashboardspaged,searchable,pageSize,sortable,titleadditionalDashboardsis a function and cannot be expressed in config, so it stays a prop of the legacyEntityGrafanaDashboardsCardonly; the docs say so.The legacy components and their props are untouched; without config the cards render exactly as before.
Changes
src/alpha/entityCards.tsx:makeWithOverrides+configSchemafor both cards; sharedtableOptionsSchemafor the five common keys.src/alpha/entityCards.test.tsx: two tests — config{ title, showState: true }renders the custom title and theStatecolumn on the alerts card; config{ title }renders the custom title on the dashboards card.docs/alerts-on-component-page.md,docs/dashboards-on-component-page.md: the new config keys with their defaults, next to the existing NFS example.package.json+yarn.lock:zoddependency (same^4.0.0the other workspaces use forconfigSchema)..changeset/grafana-nfs-card-config.md: patch.Verified
In
workspaces/grafana:yarn tscclean;yarn workspace @backstage-community/plugin-grafana test src/alpha src/components/AlertsCard→ 10/10 (2 suites);yarn lintclean;yarn prettier --checkclean on every touched file.