Skip to content

Migrate deprecated PF5 Wizard to composable API - #510

Merged
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/pf5-wizard-migration
Jun 25, 2026
Merged

Migrate deprecated PF5 Wizard to composable API#510
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/pf5-wizard-migration

Conversation

@blaipr

@blaipr blaipr commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Migrate all deprecated PatternFly 5 Wizard imports (Wizard, WizardContextConsumer, WizardFooter from @patternfly/react-core/deprecated) to the new PF5 composable Wizard API (Wizard, WizardStep, useWizardContext, WizardFooterWrapper from @patternfly/react-core).

After this PR, zero imports of Wizard-related components from @patternfly/react-core/deprecated remain.

Approach

The existing components/Wizard/Wizard.js wrapper is rewritten as a compatibility shim that accepts the legacy steps-array API and maps it to PF5 WizardStep children internally. This keeps callers' code changes minimal while eliminating all deprecated imports.

Key mappings in the wrapper:

  • steps[].canJumpTo -> navItem={{ isDisabled: true }} (disables sidebar nav item only; does NOT block Next/Back navigation, which isDisabled on WizardStep would)
  • steps[].enableNext -> footer={{ isNextDisabled: true }}
  • steps[].nextButtonText -> footer={{ nextButtonText }}
  • isOpen -> wraps the wizard in a <Modal>
  • onNext/onBack/onGoToStep -> onStepChange with scope detection
  • Per-step footer overrides are skipped when a custom footer element is provided, because PF5's WizardContext resolves per-step footers before the wizard-level footer

Files changed

File Change
components/Wizard/Wizard.js Rewritten: deprecated Wizard -> composable PF5 Wizard wrapper
components/LaunchPrompt/LaunchPrompt.js Import path change only
components/Schedule/shared/SchedulePromptableFields.js Import path change only
screens/Setting/Subscription/SubscriptionEdit/SubscriptionEdit.js WizardContextConsumer/WizardFooter -> useWizardContext()/WizardFooterWrapper
screens/Template/.../NodeModal.js WizardContextConsumer/WizardFooter -> useWizardContext()/WizardFooterWrapper; extracted NodeModalCustomFooter component
screens/Credential/.../CredentialPluginPrompt.js WizardContextConsumer/WizardFooter -> useWizardContext()/WizardFooterWrapper; extracted CredentialPluginFooter component

ISSUE TYPE

  • New or Enhanced Feature

COMPONENT NAME

UI

ADDITIONAL INFORMATION

Tests verified

  • Wizard.test.js - 4/4 passed
  • SubscriptionEdit.test.js - 9/9 passed (including the 3-step wizard navigation test)
  • CredentialPluginPrompt.test.js - 4/4 passed
  • LaunchPrompt.test.js - 7/7 passed
  • AdHocCommandsWizard.test.js - 6/6 passed
  • UserAndTeamAccessAdd.test.js + AddResourceRole.test.js - 8/8 passed
  • ESLint - passed clean

Replace all imports of Wizard, WizardContextConsumer, and WizardFooter
from @patternfly/react-core/deprecated with the new PF5 composable
Wizard API from @patternfly/react-core.

The Wizard wrapper (components/Wizard/Wizard.js) is rewritten as a
compatibility shim that accepts the legacy steps-array API and maps it
to PF5 WizardStep children. Key mappings:

- steps[].canJumpTo -> navItem={{ isDisabled: true }} (sidebar only,
  does not block Next/Back navigation)
- steps[].enableNext -> footer={{ isNextDisabled: true }}
- steps[].nextButtonText -> footer={{ nextButtonText }}
- isOpen -> wraps the wizard in a Modal
- onNext/onBack/onGoToStep -> onStepChange with scope detection
- Per-step footer overrides are skipped when a custom footer element
  is provided, since PF5 WizardContext resolves per-step footers
  before the wizard-level footer

Files with custom footers (SubscriptionEdit, NodeModal,
CredentialPluginPrompt) replace WizardContextConsumer render props
with useWizardContext() hook and WizardFooterWrapper.

Simple consumers (LaunchPrompt, SchedulePromptableFields) only needed
an import path change to use the wrapper.

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.

Pull request overview

This PR migrates Wizard usage away from deprecated PatternFly 5 Wizard APIs by introducing a compatibility shim in components/Wizard/Wizard.js that accepts the legacy steps-array interface while rendering via the PF5 composable Wizard, and updates several callers to use the new composable context/footer APIs.

Changes:

  • Replaced deprecated Wizard wrapper with a PF5 composable Wizard-based compatibility wrapper (legacy steps[], onNext/onBack/onGoToStep, per-step footer behavior, optional modal wrapping).
  • Updated multiple wizard consumers to stop using WizardContextConsumer/WizardFooter and instead use useWizardContext() + WizardFooterWrapper.
  • Switched remaining deprecated Wizard imports in a few components to the shared components/Wizard wrapper.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
awx/ui/src/components/Wizard/Wizard.js Rewritten wizard wrapper to map legacy steps-array API onto PF5 composable Wizard + optional Modal wrapper
awx/ui/src/components/LaunchPrompt/LaunchPrompt.js Updated to use shared Wizard wrapper instead of deprecated PF import
awx/ui/src/components/Schedule/shared/SchedulePromptableFields.js Updated to use shared Wizard wrapper instead of deprecated PF import
awx/ui/src/screens/Setting/Subscription/SubscriptionEdit/SubscriptionEdit.js Migrated custom footer to useWizardContext + WizardFooterWrapper and uses shared Wizard wrapper
awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.js Migrated custom footer to useWizardContext + WizardFooterWrapper with a dedicated footer component
awx/ui/src/screens/Credential/shared/CredentialPlugins/CredentialPluginPrompt/CredentialPluginPrompt.js Migrated custom footer to useWizardContext + WizardFooterWrapper with a dedicated footer component

Comment on lines +39 to +43
nextButtonText,
height,
style,
css: cssProp,
className,
Comment on lines +143 to +149
<Modal
isOpen={isOpen}
variant={ModalVariant.large}
showClose={false}
hasNoBodyWrapper
aria-label={title || 'Wizard'}
>
blaipr added 2 commits June 25, 2026 13:34
The nested http-proxy-middleware under webpack-dev-server regressed
from 2.0.10 back to 2.0.9 when later PRs regenerated the lockfile.
Bump the transitive dep to 2.0.10 which resolves GHSA-64mm-vxmg-q3vj.
Add onClose={onClose} to the Modal wrapper so ESC key and backdrop
clicks properly trigger the close callback. Remove the unused
css: cssProp destructuring — babel-plugin-styled-components handles
the css prop at the styled-components layer before it reaches the
component.
@blaipr

blaipr commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Fixed two issues flagged by Copilot review in dd26136:

  1. Modal missing onClose — added onClose={onClose} to the <Modal> wrapper so ESC key and backdrop clicks properly trigger the close callback. Previously only the WizardHeader's X button worked.

  2. Removed unused css: cssProp destructuringbabel-plugin-styled-components handles the css prop at the styled-components layer (compiles it into a className at build time), so the prop never reaches WizardWrapper. The destructuring was unnecessary; removing it avoids confusion about whether the prop is being forwarded.

All 24 affected tests pass (Wizard, SubscriptionEdit, CredentialPluginPrompt, LaunchPrompt).

@cigamit
cigamit merged commit 391b188 into ctrliq:main Jun 25, 2026
@cigamit cigamit self-assigned this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants