Skip to content

CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay#15935

Merged
openshift-merge-bot[bot] merged 9 commits intoopenshift:mainfrom
sg00dwin:CONSOLE-5049-migration-from-createModalLauncher
Mar 5, 2026
Merged

CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay#15935
openshift-merge-bot[bot] merged 9 commits intoopenshift:mainfrom
sg00dwin:CONSOLE-5049-migration-from-createModalLauncher

Conversation

@sg00dwin
Copy link
Member

@sg00dwin sg00dwin commented Jan 20, 2026

Remove createModalLauncher usage from DeleteHPAModal and ConsolePluginModal to eliminate React Router wrapper conflicts. Both modals now use the useOverlay pattern with OverlayComponent wrappers. This change is part of CONSOLE-5012 to unblock the React Router v7 upgrade.

Modals Migrated

  1. DeleteHPAModal (packages/console-shared/src/components/hpa/DeleteHPAModal.tsx)

    • Migrated to DeleteHPAModalOverlay: OverlayComponent
    • Consumer updated: packages/console-app/src/actions/creators/hpa-factory.ts
  2. ConsolePluginModal (packages/console-shared/src/components/modals/ConsolePluginModal.tsx)

    • Migrated to ConsolePluginModalOverlay: OverlayComponent
    • Backwards-compatible wrapper: consolePluginModal() function in index.ts
    • Consumer updated: packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx

Changes

  • Exported modal overlays as OverlayComponent using the *ModalOverlay naming convention
  • Wrapped modal components with ModalWrapper and connected to overlay lifecycle (closeOverlay)
  • Updated consumers to use useOverlay hook with launchModal() instead of direct modal calls
  • Added backwards-compatible consolePluginModal() wrapper for gradual migration

Scope Note

Consumer in clusterserviceversion.tsx intentionally excluded:

  • The ConsolePluginModal usage in packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx uses the backwards-compatible consolePluginModal() wrapper
  • OLM consumer updates are being handled separately in PR #15968 to avoid conflicts
  • The backwards-compatible wrapper internally calls the new ConsolePluginModalOverlay pattern, so the migration is still functional

Assisted by: Claude Code

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 20, 2026
@openshift-ci openshift-ci bot requested review from rhamilto and spadgett January 20, 2026 18:58
@openshift-ci openshift-ci bot added component/core Related to console core functionality component/olm Related to OLM component/shared Related to console-shared labels Jan 20, 2026
@sg00dwin sg00dwin changed the title [WIP] Migrate modals from createModalLauncher to useOverlay [WIP] CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay Jan 20, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 20, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 20, 2026

@sg00dwin: This pull request references CONSOLE-5049 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Remove createModalLauncher usage from DeleteHPAModal and ConsolePluginModal to eliminate React Router wrapper conflicts. Both modals now use the useOverlay pattern with Provider wrappers. This change is part of CONSOLE-5012 to unblock the React Router v7 upgrade.

Assisted by: Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sg00dwin
Copy link
Member Author

/jira refresh

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 20, 2026

@sg00dwin: This pull request references CONSOLE-5049 which is a valid jira issue.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

Nice work, @sg00dwin. Just one observation.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 21, 2026

@sg00dwin: This pull request references CONSOLE-5049 which is a valid jira issue.

Details

In response to this:

Remove createModalLauncher usage from DeleteHPAModal and ConsolePluginModal to eliminate React Router wrapper conflicts. Both modals now use the useOverlay pattern with Provider wrappers. This change is part of CONSOLE-5012 to unblock the React Router v7 upgrade.

Modals refactored
DeleteHPAModal.tsx
ConsolePluginModal.tsx

Assisted by: Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sg00dwin sg00dwin force-pushed the CONSOLE-5049-migration-from-createModalLauncher branch from f2fb0b5 to 3517ef6 Compare January 21, 2026 17:44
@sg00dwin sg00dwin changed the title [WIP] CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay Jan 21, 2026
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 21, 2026
Copy link
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

One thing Claude caught as I was working on other migrations

@sg00dwin sg00dwin force-pushed the CONSOLE-5049-migration-from-createModalLauncher branch from 3517ef6 to 582b790 Compare January 21, 2026 20:03
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 21, 2026

@sg00dwin: This pull request references CONSOLE-5049 which is a valid jira issue.

Details

In response to this:

Remove createModalLauncher usage from DeleteHPAModal and ConsolePluginModal to eliminate React Router wrapper conflicts. Both modals now use the useOverlay pattern with Provider wrappers. This change is part of CONSOLE-5012 to unblock the React Router v7 upgrade.

Modals refactored
DeleteHPAModal.tsx
ConsolePluginModal.tsx

Assisted by: Claude Code

Summary by CodeRabbit

  • Refactor
  • Updated modal handling for HPA deletion and console plugin configuration to use a consistent overlay-based presentation pattern, improving internal consistency across modal interactions.

✏️ Tip: You can customize this high-level summary in your review settings.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This PR refactors modal invocation patterns across multiple console packages, transitioning from direct modal launcher functions to an overlay-based architecture using the useOverlay hook and OverlayComponent providers. Affected areas include HPA (Horizontal Pod Autoscaler) action management, Console Plugin configuration modals, and cluster service version components. The changes replace createModalLauncher exports with provider components that wrap modal logic within ModalWrapper, while components now acquire overlay launchers through useOverlay() hooks to trigger modal display. Public exports and component signatures are updated accordingly to reflect the new pattern.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'CONSOLE-5049: Migrate modals from createModalLauncher to useOverlay' accurately and specifically summarizes the main change across all modified files—replacing the createModalLauncher pattern with the useOverlay hook-based pattern for modal invocations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx (1)

243-283: Pass csvPluginsCount into the modal launch.
Line 278 opens the modal without csvPluginsCount, so ConsolePluginModal falls back to the single-plugin copy path. Since csvPluginsCount is computed at Line 257, forward it to preserve the operator-scoped messaging.

🛠️ Suggested fix
-                    launchOverlay(ConsolePluginModalProvider, {
-                      consoleOperatorConfig,
-                      pluginName,
-                      trusted,
-                    })
+                    launchOverlay(ConsolePluginModalProvider, {
+                      consoleOperatorConfig,
+                      csvPluginsCount,
+                      pluginName,
+                      trusted,
+                    })
🤖 Fix all issues with AI agents
In `@frontend/packages/console-app/src/actions/creators/hpa-factory.ts`:
- Around line 116-117: The eslint-disable comment incorrectly references
launchModal while the hook variable is named launchOverlay, causing a
stale/confusing comment; update the comment to reference launchOverlay (or
remove the disable if you can re-enable react-hooks/exhaustive-deps) near the
place where launchOverlay is used (the hook/variable named launchOverlay in
hpa-factory.ts) so the dependency comment accurately reflects the actual
dependency and prevents confusion for future maintainers.
- Around line 102-107: The delete CTA currently always passes only
relatedHPAs[0] to DeleteHPAModalProvider, which prevents deleting additional
HPAs; modify the cta in hpa-factory.ts to check relatedHPAs.length and when >1
either open a selector (e.g., launch a small picker overlay listing relatedHPAs
so the user can choose which HPA to delete) or pass the entire relatedHPAs array
to a revised DeleteHPAModalProvider that shows a list with delete actions, and
when length === 1 continue to pass relatedHPAs[0]; update references to
relatedHPAs, launchOverlay, and DeleteHPAModalProvider accordingly.

Comment on lines +102 to +107
cta: () => {
launchOverlay(DeleteHPAModalProvider, {
workload: resource,
hpa: relatedHPAs[0],
});
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for DeleteHPAModal usage and related patterns
rg -n -C5 'deleteHPAModal|DeleteHPAModal' --type=ts --type=tsx

Repository: openshift/console

Length of output: 88


🏁 Script executed:

# Look at the hpa-factory.ts file to understand the relatedHPAs population
cat -n frontend/packages/console-app/src/actions/creators/hpa-factory.ts | head -150

Repository: openshift/console

Length of output: 5067


🏁 Script executed:

# Check for any comments or tests about multiple HPA scenarios
rg -n -C3 'relatedHPAs|multiple.*HPA|HPA.*multiple' --type=ts --type=tsx

Repository: openshift/console

Length of output: 88


🏁 Script executed:

# Find and examine the doesHpaMatch function
rg -n -C10 'export.*doesHpaMatch|function.*doesHpaMatch' --type=ts

Repository: openshift/console

Length of output: 1237


🏁 Script executed:

# Look at the DeleteHPAModal component
find . -name 'DeleteHPAModal*' -type f | head -5

Repository: openshift/console

Length of output: 133


🏁 Script executed:

# Search for any tests or comments about multiple HPAs
rg -n 'multiple.*HPA|HPA.*multiple|relatedHPAs.*length|relatedHPAs\[' --type=ts | head -20

Repository: openshift/console

Length of output: 586


🏁 Script executed:

# Check if there are any related issues or TODOs
rg -n 'TODO|FIXME|BUG' frontend/packages/console-app/src/actions/creators/hpa-factory.ts

Repository: openshift/console

Length of output: 43


🏁 Script executed:

# Read the DeleteHPAModal component
cat -n ./frontend/packages/console-shared/src/components/hpa/DeleteHPAModal.tsx

Repository: openshift/console

Length of output: 4439


🏁 Script executed:

# Search for test files related to HPA
fd -e test.ts -e spec.ts hpa | head -20

Repository: openshift/console

Length of output: 208


🏁 Script executed:

# Check for tests in hpa-factory.ts
rg -n 'test|describe|it(' frontend/packages/console-app/src/actions/creators/ | grep -i hpa

Repository: openshift/console

Length of output: 145


🏁 Script executed:

# Check the HPA utils tests
cat -n frontend/packages/console-shared/src/utils/__tests__/hpa-utils.spec.ts

Repository: openshift/console

Length of output: 728


🏁 Script executed:

# Also check the dev-console HPA tests
cat -n frontend/packages/dev-console/src/components/hpa/__tests__/hpa-utils.spec.ts | head -100

Repository: openshift/console

Length of output: 5392


🏁 Script executed:

# Search for any architectural decisions or comments about multiple HPAs
rg -n 'multiple|single|one.*HPA|HPA.*one' frontend/packages/console-shared/src/utils/hpa-utils.ts frontend/packages/console-shared/src/components/hpa/DeleteHPAModal.tsx

Repository: openshift/console

Length of output: 350


Handle multiple HPAs targeting the same workload in the delete action.

The delete action passes relatedHPAs[0] to the DeleteHPAModal without checking if multiple HPAs target the workload. While Kubernetes discourages it, the API allows multiple HPAs per workload. When this occurs, only the first HPA can be deleted through the UI—users with multiple HPAs won't be able to remove the others. Either add a selection mechanism when multiple HPAs are present, warn the user, or document this as an unsupported edge case.

🤖 Prompt for AI Agents
In `@frontend/packages/console-app/src/actions/creators/hpa-factory.ts` around
lines 102 - 107, The delete CTA currently always passes only relatedHPAs[0] to
DeleteHPAModalProvider, which prevents deleting additional HPAs; modify the cta
in hpa-factory.ts to check relatedHPAs.length and when >1 either open a selector
(e.g., launch a small picker overlay listing relatedHPAs so the user can choose
which HPA to delete) or pass the entire relatedHPAs array to a revised
DeleteHPAModalProvider that shows a list with delete actions, and when length
=== 1 continue to pass relatedHPAs[0]; update references to relatedHPAs,
launchOverlay, and DeleteHPAModalProvider accordingly.

Copy link
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

Couple of suggestions that came from the review of #15932

@sg00dwin sg00dwin force-pushed the CONSOLE-5049-migration-from-createModalLauncher branch from 582b790 to 0eb2387 Compare January 30, 2026 22:24
@sg00dwin
Copy link
Member Author

sg00dwin commented Feb 3, 2026

/test e2e-gcp-console

1 similar comment
@sg00dwin
Copy link
Member Author

sg00dwin commented Feb 3, 2026

/test e2e-gcp-console

@sg00dwin
Copy link
Member Author

/retest-required

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 24, 2026
@rhamilto
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 24, 2026
@rhamilto
Copy link
Member

@sg00dwin, looks like you have a linter error.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2026
@sg00dwin
Copy link
Member Author

@rhamilto pushed fixes for the lint issues. Please retag thanks

@rhamilto
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 26, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto, sg00dwin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhamilto
Copy link
Member

/retest

1 similar comment
@rhamilto
Copy link
Member

/retest

@sg00dwin
Copy link
Member Author

sg00dwin commented Mar 2, 2026

/test e2e-gcp-console

@sg00dwin
Copy link
Member Author

sg00dwin commented Mar 2, 2026

/assign yanpzhan for verification

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 2, 2026

@sg00dwin: GitHub didn't allow me to assign the following users: verification, for.

Note that only openshift members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign yanpzhan for verification

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@yapei
Copy link
Contributor

yapei commented Mar 4, 2026

/assign @XiyunZhao
for verification

@XiyunZhao
Copy link
Contributor

/verified by @XiyunZhao
Do regression test on HPA, consoleplugin and related page, no issue was found

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 4, 2026
@openshift-ci-robot
Copy link
Contributor

@XiyunZhao: This PR has been marked as verified by @XiyunZhao.

Details

In response to this:

/verified by @XiyunZhao
Do regression test on HPA, consoleplugin and related page, no issue was found

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jhadvig
Copy link
Member

jhadvig commented Mar 4, 2026

/retest

@sg00dwin
Copy link
Member Author

sg00dwin commented Mar 4, 2026

/test e2e-gcp-console

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 5, 2026

@sg00dwin: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jhadvig
Copy link
Member

jhadvig commented Mar 5, 2026

/override ci/prow/e2e-gcp-console

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 5, 2026

@jhadvig: Overrode contexts on behalf of jhadvig: ci/prow/e2e-gcp-console

Details

In response to this:

/override ci/prow/e2e-gcp-console

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@sg00dwin
Copy link
Member Author

sg00dwin commented Mar 5, 2026

/retest-required

@openshift-merge-bot openshift-merge-bot bot merged commit 2ccde34 into openshift:main Mar 5, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/olm Related to OLM component/shared Related to console-shared docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants