Skip to content

feat(cost-management): add New Frontend System /alpha export - #4706

Open
PreetiW wants to merge 5 commits into
redhat-developer:mainfrom
PreetiW:RHINENG-30495-cost-management-nfs
Open

feat(cost-management): add New Frontend System /alpha export#4706
PreetiW wants to merge 5 commits into
redhat-developer:mainfrom
PreetiW:RHINENG-30495-cost-management-nfs

Conversation

@PreetiW

@PreetiW PreetiW commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Hey, I just made a Pull Request!

Fixes RHINENG-30495.

Add a New Frontend System /alpha export so Cost Management loads in RHDH 2.1 (app-next + ENABLE_STANDARD_MODULE_FEDERATION=true). RHDH 2.1 no longer hosts the legacy frontend; without this the plugin cannot be discovered as an NFS feature.

What this PR does

  • Dual export: NFS at @red-hat-developer-hub/plugin-cost-management/alpha (createFrontendPlugin default export). Legacy createPlugin / ResourceOptimizationPage / OpenShiftPage / PluginRoot stay on the main export.
  • Two PageBlueprints (flat sidebar; no nested parent group):
    • Optimizations/cost-management/optimizations (page:cost-management)
    • Cost Management/cost-management/openshift (page:cost-management/openshift)
  • Three ApiBlueprints (optimizations, orchestrator-slim, cost-management-slim) and an IconBundleBlueprint.
  • OptimizationsRouter for NFS (list + /:id breakdown only). OpenShift is a separate page, not a nested route under Optimizations.
  • usePatternFlyTheme() on OpenShiftPage so the standalone OpenShift page still applies PatternFly theme/header behavior under NFS.
  • Workspace app split (same pattern as orchestrator / adoption-insights): packages/app is NFS + RHDH theme (yarn start); current shell moved to packages/app-legacy (yarn start:legacy). Both share the full RBAC backend.
  • Standalone plugin entries: NFS dev/index.tsx (yarn start:fe-plugin); legacy createDevApp in dev/legacy.tsx (yarn start:fe-plugin:legacy).
  • Docs, API report (report-alpha.api.md), and a minor changeset.

Out of scope (follow-ups)

  • Nested sidebar (menuItems.parent) — RHDH NFS gap; see RHDH-specific gaps.
  • Overlay / catalog / OCI YAML — separate change.
  • QE on an RHDH 2.1 RC — after merge.

Test plan

Run from workspaces/cost-management/ (Node 22 or 24). Live data needs costManagement.clientId / clientSecret in app-config.local.yaml. RBAC uses policy.local.csv.

1. Install and unit tests

cd workspaces/cost-management
yarn install
yarn test plugins/cost-management/src/alpha.test.tsx

Expect 6 passing tests: plugin validity and id, routes, extension ids, Optimizations path/title, OpenShift path with title Cost Management.

Optional extra checks:

yarn tsc
yarn workspace @red-hat-developer-hub/plugin-cost-management lint

2. NFS workspace app (primary review path)

yarn start

This starts packages/app (NFS + RHDH theme) and packages/backend (permission + RBAC). Frontend typically http://localhost:3000, backend http://localhost:7007.

  • Sign in as guest (or GitHub).
  • Sidebar shows Optimizations and Cost Management (flat items, not a nested “Cost management” group), with RHDH theme chrome.
  • Optimizations: list loads according to policy.local.csv; click a recommendation and confirm /cost-management/optimizations/:id breakdown still works.
  • Cost Management: /cost-management/openshift loads (theme/header present; not a blank page). Direct URL works without going through Optimizations.
  • Cluster/project filtering follows policy.local.csv (this is the full backend, not allow-all).

3. Legacy workspace app (no regression)

yarn start:legacy
  • Same backend as above.
  • packages/app-legacy still uses createApp / FlatRoutes.
  • /cost-management/optimizations and /cost-management/openshift still render.
  • Nested /cost-management/optimizations/openshift on the legacy Router is unchanged (NFS does not use that nested path).

4. Plugin-only (optional, no RBAC)

yarn start:fe-plugin          # NFS webpack plugin
yarn start:fe-plugin:legacy   # createDevApp

These do not load the permission/RBAC plugins. Use yarn start / yarn start:legacy to test policies.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@rhdh-gh-app

rhdh-gh-app Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
app-legacy workspaces/cost-management/packages/app-legacy none v0.0.5
app workspaces/cost-management/packages/app none v0.0.5
@red-hat-developer-hub/plugin-cost-management workspaces/cost-management/plugins/cost-management minor v2.3.0

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.72%. Comparing base (10d9880) to head (5d18ff2).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4706   +/-   ##
=======================================
  Coverage   62.72%   62.72%           
=======================================
  Files        2636     2637    +1     
  Lines      105422   105431    +9     
  Branches    29556    29546   -10     
=======================================
+ Hits        66125    66131    +6     
- Misses      37489    37496    +7     
+ Partials     1808     1804    -4     
Flag Coverage Δ *Carryforward flag
adoption-insights 84.77% <ø> (ø) Carriedforward from 41c39bf
ai-integrations 78.80% <ø> (ø) Carriedforward from 41c39bf
app-defaults 53.07% <ø> (ø) Carriedforward from 41c39bf
augment 46.67% <ø> (ø) Carriedforward from 41c39bf
boost 83.46% <ø> (ø) Carriedforward from 41c39bf
bulk-import 73.12% <ø> (ø) Carriedforward from 41c39bf
cost-management 13.53% <0.00%> (+0.18%) ⬆️
dcm 73.47% <ø> (ø) Carriedforward from 41c39bf
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from 41c39bf
e2e-extensions 62.31% <ø> (ø) Carriedforward from 41c39bf
e2e-global-header 49.71% <ø> (ø) Carriedforward from 41c39bf
e2e-homepage 61.11% <ø> (ø) Carriedforward from 41c39bf
e2e-intelligent-assistant 46.09% <ø> (ø) Carriedforward from 41c39bf
e2e-orchestrator 49.52% <ø> (ø) Carriedforward from 41c39bf
e2e-orchestrator-plugin 49.51% <ø> (ø) Carriedforward from 41c39bf
e2e-quickstart 55.21% <ø> (ø) Carriedforward from 41c39bf
e2e-scorecard 50.05% <ø> (ø) Carriedforward from 41c39bf
e2e-theme 16.36% <ø> (ø) Carriedforward from 41c39bf
extensions 57.37% <ø> (ø) Carriedforward from 41c39bf
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 41c39bf
global-header 67.88% <ø> (ø) Carriedforward from 41c39bf
homepage 48.39% <ø> (ø) Carriedforward from 41c39bf
install-dynamic-plugins 71.94% <ø> (ø) Carriedforward from 41c39bf
intelligent-assistant 77.26% <ø> (ø) Carriedforward from 41c39bf
konflux 91.98% <ø> (ø) Carriedforward from 41c39bf
lightspeed 69.02% <ø> (ø) Carriedforward from 41c39bf
mcp-integrations 84.46% <ø> (ø) Carriedforward from 41c39bf
orchestrator 72.02% <ø> (ø) Carriedforward from 41c39bf
quickstart 63.74% <ø> (ø) Carriedforward from 41c39bf
sandbox 79.56% <ø> (ø) Carriedforward from 41c39bf
scorecard 88.20% <ø> (ø) Carriedforward from 41c39bf
theme 87.91% <ø> (ø) Carriedforward from 41c39bf
translations 5.12% <ø> (ø) Carriedforward from 41c39bf
x2a 77.18% <ø> (ø) Carriedforward from 41c39bf

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10d9880...5d18ff2. Read the comment docs.

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

PreetiW and others added 4 commits September 11, 2026 18:44
Ship a dual-export frontend so the plugin loads in RHDH 2.1 while keeping
legacy PluginRoot wiring. NFS sidebar uses Optimizations and Cost Management.

Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Split packages/app into an NFS frontend (yarn start) and app-legacy
(yarn start:legacy) so reviewers can exercise /alpha against the full
RBAC backend with the RHDH theme.

Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Yarn start landed on `/` with no page. Redirect to `/catalog` like
the legacy app, and register the RBAC `/alpha` plugin so reviewers
can edit policies without switching to app-legacy.

Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>
Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
@PreetiW
PreetiW force-pushed the RHINENG-30495-cost-management-nfs branch from c7d5015 to 41c39bf Compare September 11, 2026 13:15
Reuse the legacy Administration sidebar item so RBAC is shown only
when getUserAuthorization() returns Authorized, matching yarn start:legacy.

Signed-off-by: Preeti Wadhwani <preeti.dev.git@gmail.com>
Assisted-by: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud

Copy link
Copy Markdown

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