Skip to content

fix(grafana): expose card table options as extension config in the New Frontend System - #11121

Open
MatheusMartinho wants to merge 3 commits into
backstage:mainfrom
MatheusMartinho:grafana-nfs-alert-state
Open

MatheusMartinho wants to merge 3 commits into
backstage:mainfrom
MatheusMartinho:grafana-nfs-alert-state

Conversation

@MatheusMartinho

Copy link
Copy Markdown
Contributor

Fixes #10991.

What the bug was

In the New Frontend System the Grafana entity cards were registered with EntityCardBlueprint.make and 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 its State column, and neither card's title, paged, pageSize, searchable or sortable could 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.makeWithOverrides with a configSchema, following the pattern already used by the jenkins, github-actions and entity-feedback workspaces, and spread the config into the component:

app:
  extensions:
    - entity-card:grafana/alerts:
        config:
          showState: true
          title: Grafana alerts

Exposed keys — all optional, omitting one keeps the component default:

card keys
entity-card:grafana/alerts paged, searchable, pageSize, sortable, title, showState
entity-card:grafana/dashboards paged, searchable, pageSize, sortable, title

additionalDashboards is a function and cannot be expressed in config, so it stays a prop of the legacy EntityGrafanaDashboardsCard only; 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 + configSchema for both cards; shared tableOptionsSchema for the five common keys.
  • src/alpha/entityCards.test.tsx: two tests — config { title, showState: true } renders the custom title and the State column 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: zod dependency (same ^4.0.0 the other workspaces use for configSchema).
  • .changeset/grafana-nfs-card-config.md: patch.
  • API report regenerated for the alpha entry point (the declared types of the two cards changed).

Verified

In workspaces/grafana: yarn tsc clean; yarn workspace @backstage-community/plugin-grafana test src/alpha src/components/AlertsCard → 10/10 (2 suites); yarn lint clean; yarn prettier --check clean on every touched file.

@backstage-goalie

backstage-goalie Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-grafana workspaces/grafana/plugins/grafana patch v1.0.0

…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]>
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]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

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!

@github-actions github-actions Bot added the stale label Nov 1, 2026
@roy3861

roy3861 commented Nov 2, 2026

Copy link
Copy Markdown

Any plans to merge the Fix which addresses : #11121 (comment)?

Four your kind attention: @Parsifal-M for reveiw.

@awanlin awanlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MatheusMartinho, this looks pretty solid but there's a merge conflict, can you fix that please?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Grafana: Alert Card Do no show State Column in New FrontEnd System

5 participants