Skip to content

[WIP] CONSOLE-4447: Migrate modal hooks from useModal to useOverlay#16061

Open
rhamilto wants to merge 7 commits intoopenshift:mainfrom
rhamilto:CONSOLE-4447-use-modal
Open

[WIP] CONSOLE-4447: Migrate modal hooks from useModal to useOverlay#16061
rhamilto wants to merge 7 commits intoopenshift:mainfrom
rhamilto:CONSOLE-4447-use-modal

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Feb 24, 2026

Summary

Migrates modal hooks and components from the deprecated useModal API to the modern useOverlay API, and fixes React deprecation warnings for defaultProps.

Note: this PR requires changes from #16061, so it should merge first.

Changes

Modal Hook Migrations (useModal → useOverlay)

  • useAnnotationsModal - Uses LazyAnnotationsModalOverlay
  • useLabelsModal - Uses LazyLabelsModalOverlay
  • useDeleteModal - Uses LazyDeleteModalOverlay
  • useCreateNamespaceModal
  • useCreateProjectModal
  • useCreateNamespaceOrProjectModal
  • useCopyCodeModal
  • IdentityProviders component

Modal Component Migrations (ModalComponent → OverlayComponent)

  • AnnotationsModalOverlay - Updated to PatternFly 6 Modal
  • CreateNamespaceModal - Updated to OverlayComponent
  • CreateProjectModal - Updated with backward compatibility
  • RemoveIdentityProviderModal - Updated to PatternFly 6 Modal with titleIconVariant="warning"
  • CopyCodeModal - Updated to OverlayComponent

Action Hook Refactoring

  • useCommonActions - Refactored to use dedicated modal hooks instead of manual launchModal calls
  • dev-console/context-menu - Updated useDeleteResourceAction to use useDeleteModal with cleanUpWorkload callback
  • operator-lifecycle-manager/useDefaultOperandActions - Updated to use useDeleteModal with redirect path
  • operator-lifecycle-manager/useOperatorActions - Updated to use useDeleteModal for CSV deletion

React Deprecation Fixes

  • NameValueEditor - Replaced defaultProps with JavaScript default parameters
  • EnvFromEditor - Replaced defaultProps with JavaScript default parameters

Implementation Details

  • All hooks now use consistent launchModal naming for the overlay launcher function
  • Lazy-loaded modal components are used where available for optimal bundle splitting
  • Modal components properly typed as OverlayComponent<PropsType> which automatically adds closeOverlay prop
  • All closeModal references replaced with closeOverlay
  • Action creators refactored to use dedicated modal hooks (useDeleteModal, useAnnotationsModal, useLabelsModal) instead of manually calling useOverlay with lazy overlays
  • Fixed import paths to use direct imports instead of barrel exports where needed

Not Migrated (Plugin API Constraints)

The following components cannot be migrated without breaking the plugin extension API:

  • AlertItem.tsx - Uses AlertAction extension which expects LaunchModal type
  • notification-drawer.tsx - Passes modal launcher to alert action extensions

These will require a coordinated migration of the AlertAction extension API.

Test Plan

  • Manually tested modal workflows
  • Verified lazy loading works correctly
  • ESLint passes
  • No TypeScript errors

Related Issues

CONSOLE-4447

🤖 Generated with Claude Code

rhamilto and others added 6 commits February 19, 2026 16:40
Update Cancel button variants from "secondary" to "link" in modern
PatternFly modals to follow PatternFly standards.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… wrapper

- Migrate useCopyCodeModal, FavoriteButton, and TourStepComponent from
  deprecated Modal wrapper to modern PatternFly Modal components
- Remove deprecated Modal wrapper (packages/console-shared/src/components/modal/)
- Migrate CatalogDetailsModal and operator-hub-items from deprecated
  PatternFly Modal to modern Modal components
- Preserve ocs-modal CSS class for catalog modal positioning
- Fix FavoriteButton form submission bug by adding preventDefault
- Fix Guided Tour accessibility warning by closing Help dropdown and
  blurring focus before starting tour

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Migrate DeleteModal from deprecated factory/modal components to
  modern PatternFly v6 Modal components
- Create reusable ModalFooterWithAlerts component for alert display
- Update configure-count-modal and configure-machine-autoscaler-modal
  to use modern Modal components and ModalFooterWithAlerts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… components

This commit updates multiple modal components to use modern PatternFly v6
patterns and replaces deprecated error display components with the new
ModalFooterWithAlerts component.

Changes:
- Replace ModalErrorContent with ModalFooterWithAlerts in:
  - clone-pvc-modal.tsx
  - modify-vac-modal.tsx
  - ResourceLimitsModal.tsx
  - restore-pvc-modal.tsx
  - ConfigureUnschedulableModal.tsx
  - DeletePDBModal.tsx
- Remove onSubmit handlers from Form elements
- Move form submission to onClick handlers on submit buttons
- Add form attribute to submit buttons to associate with form id
- Fix Formik type compatibility in ResourceLimitsModal by wrapping
  handleSubmit in arrow function
- Delete unused SCSS files:
  - packages/console-app/src/components/modals/clone/_clone-pvc-modal.scss
  - packages/console-app/src/components/modals/restore-pvc/restore-pvc-modal.scss

All modals now follow the PatternFly "with form" pattern with consistent
error/alert display using ModalFooterWithAlerts.
Migrate the following modals from deprecated PatternFly Modal to v6:
- CreateProjectModal: Updated to use ModalHeader, ModalBody, ModalFooterWithAlerts with Form, FormGroup, TextInput, and TextArea components
- CreateNamespaceModal: Similar updates with additional Select component for network policy
- VSphereConnectionModal: Updated with Formik integration and conditional rendering
- ReplaceCodeModal: Simple modal migration with three action buttons and close button test
- TestFunctionModal: Remove position prop so the modal uses default center positioning

All modals now use:
- PatternFly 6 Modal structure (ModalHeader, ModalBody, ModalFooter)
- Modern form components (Form, FormGroup, TextInput, TextArea)
- ModalFooterWithAlerts for error handling where applicable
- Proper form/button association using id and form attributes

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit migrates several modal-related hooks and components from the
deprecated useModal API to the modern useOverlay API, and addresses React
deprecation warnings.

Modal Hook Migrations (useModal → useOverlay):
- useAnnotationsModal: Now uses LazyAnnotationsModalOverlay
- useLabelsModal: Now uses LazyLabelsModalOverlay
- useDeleteModal: Now uses LazyDeleteModalOverlay
- useCreateNamespaceModal: Migrated to useOverlay
- useCreateProjectModal: Migrated to useOverlay
- useCreateNamespaceOrProjectModal: Migrated to useOverlay
- useCopyCodeModal: Migrated to useOverlay
- IdentityProviders: Migrated to useOverlay with openRemoveModal callback

Modal Component Migrations (ModalComponent → OverlayComponent):
- AnnotationsModalOverlay: Updated to use OverlayComponent and PF6 Modal
- CreateNamespaceModal: Updated to use OverlayComponent and closeOverlay
- CreateProjectModal: Updated to use OverlayComponent with backward compatibility
- RemoveIdentityProviderModal: Updated to use OverlayComponent and PF6 Modal with titleIconVariant="warning"
- CopyCodeModal: Updated to use OverlayComponent

React Deprecation Fixes:
- NameValueEditor: Replaced defaultProps with JavaScript default parameters
- EnvFromEditor: Replaced defaultProps with JavaScript default parameters

All hooks now use consistent 'launchModal' naming for the overlay launcher
function. Lazy-loaded modal components are used where available for optimal
bundle splitting.

Note: AlertItem.tsx and notification-drawer.tsx cannot be migrated as they
use the AlertAction plugin extension API which expects LaunchModal type.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 24, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 24, 2026

@rhamilto: This pull request references CONSOLE-4447 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrates modal hooks and components from the deprecated useModal API to the modern useOverlay API, and fixes React deprecation warnings for defaultProps.

Changes

Modal Hook Migrations (useModal → useOverlay)

  • useAnnotationsModal - Uses LazyAnnotationsModalOverlay
  • useLabelsModal - Uses LazyLabelsModalOverlay
  • useDeleteModal - Uses LazyDeleteModalOverlay
  • useCreateNamespaceModal
  • useCreateProjectModal
  • useCreateNamespaceOrProjectModal
  • useCopyCodeModal
  • IdentityProviders component

Modal Component Migrations (ModalComponent → OverlayComponent)

  • AnnotationsModalOverlay - Updated to PatternFly 6 Modal
  • CreateNamespaceModal - Updated to OverlayComponent
  • CreateProjectModal - Updated with backward compatibility
  • RemoveIdentityProviderModal - Updated to PatternFly 6 Modal with titleIconVariant="warning"
  • CopyCodeModal - Updated to OverlayComponent

React Deprecation Fixes

  • NameValueEditor - Replaced defaultProps with JavaScript default parameters
  • EnvFromEditor - Replaced defaultProps with JavaScript default parameters

Implementation Details

  • All hooks now use consistent launchModal naming for the overlay launcher function
  • Lazy-loaded modal components are used where available for optimal bundle splitting
  • Modal components properly typed as OverlayComponent<PropsType> which automatically adds closeOverlay prop
  • All closeModal references replaced with closeOverlay

Not Migrated (Plugin API Constraints)

The following components cannot be migrated without breaking the plugin extension API:

  • AlertItem.tsx - Uses AlertAction extension which expects LaunchModal type
  • notification-drawer.tsx - Passes modal launcher to alert action extensions

These will require a coordinated migration of the AlertAction extension API.

Test Plan

  • Manually tested modal workflows
  • Verified lazy loading works correctly
  • ESLint passes
  • No TypeScript errors

Related Issues

CONSOLE-4447

🤖 Generated with 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.

@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 Feb 24, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 24, 2026

@rhamilto: This pull request references CONSOLE-4447 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrates modal hooks and components from the deprecated useModal API to the modern useOverlay API, and fixes React deprecation warnings for defaultProps.

Changes

Modal Hook Migrations (useModal → useOverlay)

  • useAnnotationsModal - Uses LazyAnnotationsModalOverlay
  • useLabelsModal - Uses LazyLabelsModalOverlay
  • useDeleteModal - Uses LazyDeleteModalOverlay
  • useCreateNamespaceModal
  • useCreateProjectModal
  • useCreateNamespaceOrProjectModal
  • useCopyCodeModal
  • IdentityProviders component

Modal Component Migrations (ModalComponent → OverlayComponent)

  • AnnotationsModalOverlay - Updated to PatternFly 6 Modal
  • CreateNamespaceModal - Updated to OverlayComponent
  • CreateProjectModal - Updated with backward compatibility
  • RemoveIdentityProviderModal - Updated to PatternFly 6 Modal with titleIconVariant="warning"
  • CopyCodeModal - Updated to OverlayComponent

React Deprecation Fixes

  • NameValueEditor - Replaced defaultProps with JavaScript default parameters
  • EnvFromEditor - Replaced defaultProps with JavaScript default parameters

Implementation Details

  • All hooks now use consistent launchModal naming for the overlay launcher function
  • Lazy-loaded modal components are used where available for optimal bundle splitting
  • Modal components properly typed as OverlayComponent<PropsType> which automatically adds closeOverlay prop
  • All closeModal references replaced with closeOverlay

Not Migrated (Plugin API Constraints)

The following components cannot be migrated without breaking the plugin extension API:

  • AlertItem.tsx - Uses AlertAction extension which expects LaunchModal type
  • notification-drawer.tsx - Passes modal launcher to alert action extensions

These will require a coordinated migration of the AlertAction extension API.

Test Plan

  • Manually tested modal workflows
  • Verified lazy loading works correctly
  • ESLint passes
  • No TypeScript errors

Related Issues

CONSOLE-4447

🤖 Generated with 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.

@openshift-ci openshift-ci bot requested review from jhadvig and rawagner February 24, 2026 21:10
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Feb 24, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 24, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto

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

@openshift-ci openshift-ci bot added component/knative Related to knative-plugin approved Indicates a PR has been approved by an approver from all required OWNERS files. component/metal3 Related to metal3-plugin component/olm Related to OLM component/shared Related to console-shared kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Feb 24, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 24, 2026

@rhamilto: This pull request references CONSOLE-4447 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrates modal hooks and components from the deprecated useModal API to the modern useOverlay API, and fixes React deprecation warnings for defaultProps.

Note: this PR requires changes from #16061, so it should merge first.

Changes

Modal Hook Migrations (useModal → useOverlay)

  • useAnnotationsModal - Uses LazyAnnotationsModalOverlay
  • useLabelsModal - Uses LazyLabelsModalOverlay
  • useDeleteModal - Uses LazyDeleteModalOverlay
  • useCreateNamespaceModal
  • useCreateProjectModal
  • useCreateNamespaceOrProjectModal
  • useCopyCodeModal
  • IdentityProviders component

Modal Component Migrations (ModalComponent → OverlayComponent)

  • AnnotationsModalOverlay - Updated to PatternFly 6 Modal
  • CreateNamespaceModal - Updated to OverlayComponent
  • CreateProjectModal - Updated with backward compatibility
  • RemoveIdentityProviderModal - Updated to PatternFly 6 Modal with titleIconVariant="warning"
  • CopyCodeModal - Updated to OverlayComponent

React Deprecation Fixes

  • NameValueEditor - Replaced defaultProps with JavaScript default parameters
  • EnvFromEditor - Replaced defaultProps with JavaScript default parameters

Implementation Details

  • All hooks now use consistent launchModal naming for the overlay launcher function
  • Lazy-loaded modal components are used where available for optimal bundle splitting
  • Modal components properly typed as OverlayComponent<PropsType> which automatically adds closeOverlay prop
  • All closeModal references replaced with closeOverlay

Not Migrated (Plugin API Constraints)

The following components cannot be migrated without breaking the plugin extension API:

  • AlertItem.tsx - Uses AlertAction extension which expects LaunchModal type
  • notification-drawer.tsx - Passes modal launcher to alert action extensions

These will require a coordinated migration of the AlertAction extension API.

Test Plan

  • Manually tested modal workflows
  • Verified lazy loading works correctly
  • ESLint passes
  • No TypeScript errors

Related Issues

CONSOLE-4447

🤖 Generated with 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.

Replace manual useOverlay/launchModal calls with dedicated modal hooks
(useDeleteModal, useAnnotationsModal, useLabelsModal) in action creators.

Changes:
- console-app/useCommonActions: Use useDeleteModal, useAnnotationsModal,
  and useLabelsModal instead of manually launching overlays
- dev-console/context-menu: Use useDeleteModal with cleanUpWorkload
  callback for delete actions
- operator-lifecycle-manager/useDefaultOperandActions: Use useDeleteModal
  with redirect path for operand deletion
- operator-lifecycle-manager/useOperatorActions: Use useDeleteModal for
  CSV deletion while keeping useOverlay for UninstallOperatorOverlay

Benefits:
- Reduces code duplication by using encapsulated hook logic
- Improves consistency across action creators
- Maintains lazy loading (hooks use lazy components internally)
- Simplifies action creator code and dependency management

Technical notes:
- Fixed import path in dev-console to use direct import from
  @console/shared/src/hooks/useDeleteModal instead of barrel export
- All hooks internally use lazy-loaded modal components
- Preserved all existing functionality including callbacks, redirects,
  and custom messages

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci openshift-ci bot added the component/dev-console Related to dev-console label Feb 24, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 24, 2026

@rhamilto: This pull request references CONSOLE-4447 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Migrates modal hooks and components from the deprecated useModal API to the modern useOverlay API, and fixes React deprecation warnings for defaultProps.

Note: this PR requires changes from #16061, so it should merge first.

Changes

Modal Hook Migrations (useModal → useOverlay)

  • useAnnotationsModal - Uses LazyAnnotationsModalOverlay
  • useLabelsModal - Uses LazyLabelsModalOverlay
  • useDeleteModal - Uses LazyDeleteModalOverlay
  • useCreateNamespaceModal
  • useCreateProjectModal
  • useCreateNamespaceOrProjectModal
  • useCopyCodeModal
  • IdentityProviders component

Modal Component Migrations (ModalComponent → OverlayComponent)

  • AnnotationsModalOverlay - Updated to PatternFly 6 Modal
  • CreateNamespaceModal - Updated to OverlayComponent
  • CreateProjectModal - Updated with backward compatibility
  • RemoveIdentityProviderModal - Updated to PatternFly 6 Modal with titleIconVariant="warning"
  • CopyCodeModal - Updated to OverlayComponent

Action Hook Refactoring

  • useCommonActions - Refactored to use dedicated modal hooks instead of manual launchModal calls
  • dev-console/context-menu - Updated useDeleteResourceAction to use useDeleteModal with cleanUpWorkload callback
  • operator-lifecycle-manager/useDefaultOperandActions - Updated to use useDeleteModal with redirect path
  • operator-lifecycle-manager/useOperatorActions - Updated to use useDeleteModal for CSV deletion

React Deprecation Fixes

  • NameValueEditor - Replaced defaultProps with JavaScript default parameters
  • EnvFromEditor - Replaced defaultProps with JavaScript default parameters

Implementation Details

  • All hooks now use consistent launchModal naming for the overlay launcher function
  • Lazy-loaded modal components are used where available for optimal bundle splitting
  • Modal components properly typed as OverlayComponent<PropsType> which automatically adds closeOverlay prop
  • All closeModal references replaced with closeOverlay
  • Action creators refactored to use dedicated modal hooks (useDeleteModal, useAnnotationsModal, useLabelsModal) instead of manually calling useOverlay with lazy overlays
  • Fixed import paths to use direct imports instead of barrel exports where needed

Not Migrated (Plugin API Constraints)

The following components cannot be migrated without breaking the plugin extension API:

  • AlertItem.tsx - Uses AlertAction extension which expects LaunchModal type
  • notification-drawer.tsx - Passes modal launcher to alert action extensions

These will require a coordinated migration of the AlertAction extension API.

Test Plan

  • Manually tested modal workflows
  • Verified lazy loading works correctly
  • ESLint passes
  • No TypeScript errors

Related Issues

CONSOLE-4447

🤖 Generated with 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.

@rhamilto
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 25, 2026

@rhamilto: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console 098e5e1 link true /test e2e-gcp-console

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.

@rhamilto
Copy link
Member Author

/retest

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/knative Related to knative-plugin component/metal3 Related to metal3-plugin component/olm Related to OLM component/shared Related to console-shared do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants