ROX-35326: Combine Prometheus metric cards into tabbed card by parametalol · Pull Request #21414 · stackrox/stackrox · GitHub
Skip to content

ROX-35326: Combine Prometheus metric cards into tabbed card#21414

Open
parametalol wants to merge 1 commit into
masterfrom
michael/ROX-35326-prometheus-metrics-tabbed-card
Open

ROX-35326: Combine Prometheus metric cards into tabbed card#21414
parametalol wants to merge 1 commit into
masterfrom
michael/ROX-35326-prometheus-metrics-tabbed-card

Conversation

@parametalol

@parametalol parametalol commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

The System Configuration page rendered separate cards for each Prometheus metrics category. With more categories being added, this doesn't scale.

Replaced the individual cards with a single Card using PatternFly Tabs — one tab per category. Each tab header shows a Badge with the count of enabled metrics. Applied to both view and edit modes.

Also fixed the "Gathering period" label wrapping by setting horizontalTermWidthModifier to 15ch.

Why tabs over cards: reduces vertical scrolling, scales to N categories without layout changes, and the badge provides an at-a-glance summary that the old Enabled/Disabled label did per-card.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  • Verified TypeScript compilation passes (npm run tsc)
  • Verified ESLint passes on all changed files
  • Visually verified on local dev server: tabs render correctly, badge counts
    match enabled metrics, tab switching works, edit mode form inputs work

View mode:
image

Edit mode:
image

Replace separate cards per metrics category with a single Card using
PatternFly Tabs. Each tab header includes a Badge showing the number
of enabled metrics. Applies to both view and edit modes.

Also fixes "Gathering period" label wrapping by widening the
horizontal description list term width.

Partially generated by AI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

@parametalol parametalol marked this pull request as ready for review June 25, 2026 15:03
@parametalol parametalol requested a review from a team as a code owner June 25, 2026 15:03
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.08%. Comparing base (ac26bf4) to head (12b6b50).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21414      +/-   ##
==========================================
- Coverage   50.12%   50.08%   -0.05%     
==========================================
  Files        2835     2835              
  Lines      217546   217546              
==========================================
- Hits       109049   108951      -98     
- Misses     100615   100693      +78     
- Partials     7882     7902      +20     
Flag Coverage Δ
go-unit-tests 50.08% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Prometheus metrics configuration and details views now render all categories through shared tabbed card and form components. The details page and form page pass the full private config into those components, and the details view drops the extra grid wrapper.

Changes

Tabbed Prometheus metrics UI

Layer / File(s) Summary
Tabbed card view
ui/apps/platform/src/Containers/SystemConfig/Details/components/PrometheusMetricsCard.tsx, ui/apps/platform/src/Containers/SystemConfig/Details/PrivateConfigPrometheusMetricsDetails.tsx, ui/apps/platform/src/Containers/SystemConfig/Details/SystemConfigDetails.tsx
PrometheusMetricsTabbedCard renders category tabs from privateConfig, and the details page now passes the full config directly into it without the extra grid wrapper.
Tabbed form view
ui/apps/platform/src/Containers/SystemConfig/Details/components/PrometheusMetricsCard.tsx, ui/apps/platform/src/Containers/SystemConfig/Form/SystemConfigForm.tsx
PrometheusMetricsTabbedForm replaces the three category-specific metrics forms, and SystemConfigForm passes values.privateConfig plus the existing change handlers into it.

Sequence Diagram(s)

sequenceDiagram
  participant SystemConfigDetails
  participant PrivateConfigPrometheusMetricsDetails
  participant PrometheusMetricsTabbedCard
  participant PrometheusMetricsTable
  participant EmptyState

  SystemConfigDetails->>PrivateConfigPrometheusMetricsDetails: pass systemConfig.privateConfig
  PrivateConfigPrometheusMetricsDetails->>PrometheusMetricsTabbedCard: render tabs from privateConfig
  PrometheusMetricsTabbedCard->>PrometheusMetricsTable: render category metrics table
  PrometheusMetricsTabbedCard->>EmptyState: render when a category has no metrics
Loading
sequenceDiagram
  participant SystemConfigForm
  participant PrometheusMetricsTabbedForm
  participant PrometheusMetricsPeriodForm
  participant PrometheusMetricsTable

  SystemConfigForm->>PrometheusMetricsTabbedForm: pass values.privateConfig, onChange, onCustomChange
  PrometheusMetricsTabbedForm->>PrometheusMetricsPeriodForm: render per-category period form
  PrometheusMetricsTabbedForm->>PrometheusMetricsTable: render per-category metrics table
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing separate Prometheus metric cards with a tabbed card.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the template and covers the change, docs/quality, and validation details; only the automated-testing checklist is left unchecked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch michael/ROX-35326-prometheus-metrics-tabbed-card

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ui/apps/platform/src/Containers/SystemConfig/Details/components/PrometheusMetricsCard.tsx`:
- Around line 409-446: The gathering period is currently tied to hasMetrics in
PrometheusMetricsCard, so a category with no enabled descriptors hides valid
period state. Update the PrometheusMetricsCard render logic to show the
DescriptionList section whenever period is set, even if descriptors is empty,
and only use the EmptyState for the no-metrics message while still rendering the
gathering period for that category.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c82d4100-b7c1-4074-90fe-f0a0f8cc388d

📥 Commits

Reviewing files that changed from the base of the PR and between 97d2a21 and 12b6b50.

📒 Files selected for processing (4)
  • ui/apps/platform/src/Containers/SystemConfig/Details/PrivateConfigPrometheusMetricsDetails.tsx
  • ui/apps/platform/src/Containers/SystemConfig/Details/SystemConfigDetails.tsx
  • ui/apps/platform/src/Containers/SystemConfig/Details/components/PrometheusMetricsCard.tsx
  • ui/apps/platform/src/Containers/SystemConfig/Form/SystemConfigForm.tsx

@github-actions

Copy link
Copy Markdown
Contributor

@dvail dvail self-requested a review June 25, 2026 16:28
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.

1 participant