CONSOLE-4712: Remove PromiseComponent and convert its dependent components to functional components
Summary
Tech Debt
This PR aims to remove PromiseComponent and convert its dependent components to function components.
Checklist:
- [X] Remove PromiseComponent and its test
- [X] Convert its dependent components to function components using
usePromiseHandlerfor promise action. Number of files/components: 8 - [X] Components refactored(6/6):
EditApplicationModal, MoveConnectionModal, DeleteResourceModal, ConfirmModal, ConfigureNamespacePullSecret, Environment - [X] Verified that
usePromiseHandlerhook provides the same promise handling behavior as the oldPromiseComponentclass
@krishagarwal278: This pull request references CONSOLE-4712 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.21.0" version, but no target version was set.
In response to this:
Summary
Tech Debt
This PR aims to remove PromiseComponent and convert its dependent components to function components.
Checklist:
- [X] Remove PromiseComponent and its test
- [ ] Convert its dependent components to function components using
usePromiseHandlerfor promise action. Number of files/components: 8- [X] Components refactored(5/6):
EditApplicationModal, MoveConnectionModal, DeleteResourceModal, ConfirmModal, ConfigureNamespacePullSecret
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.
Walkthrough
Converted several class-based PromiseComponent modals to functional components using usePromiseHandler; removed PromiseComponent and its tests; replaced legacy JSX Environment and namespace pull-secret modal with TypeScript implementations; updated dynamic import paths, i18n entries, and a Cypress test cleanup command.
Changes
| Cohort / File(s) | Summary |
|---|---|
Modal component migrations (functional + hooks) frontend/packages/console-shared/src/components/modals/DeleteResourceModal.tsx, frontend/packages/topology/src/components/modals/EditApplicationModal.tsx, frontend/packages/topology/src/components/modals/MoveConnectionModal.tsx, frontend/public/components/modals/confirm-modal.tsx |
Replaced class components that extended PromiseComponent with functional React.FC components using usePromiseHandler. Removed per-component inProgress/errorMessage state and PromiseComponent base; moved submit handlers into component scope, wrapped async submits with the promise handler, updated prop access and Formik integrations, and adjusted i18n usage. |
Configure namespace pull secret modal (deleted + added) frontend/public/components/modals/configure-ns-pull-secret-modal.jsx (deleted), frontend/public/components/modals/configure-ns-pull-secret-modal.tsx (added) |
Deleted legacy JSX modal and added a TypeScript modal implementing form/file-upload modes, JSON validation/preview, generateSecretData helper, base64 handling, Secret creation and ServiceAccount patching, async flow via promise handler, and a modal launcher export. |
Environment page refactor / new module frontend/public/components/environment.jsx (deleted), frontend/public/components/environment.tsx (added), frontend/public/components/__tests__/environment.spec.tsx |
Removed the old JSX EnvironmentPage and introduced a TypeScript EnvironmentPage with CurrentEnvVars utilities, lazy-loaded NameValueEditor/EnvFromEditor wrappers, RBAC edit checks, on-demand ConfigMap/Secret loading, patch generation and create-payload logic, and corresponding test updates to the new rawEnvData shape and props. |
PromiseComponent infra removal frontend/public/components/utils/promise-component.tsx (deleted), frontend/public/components/utils/__tests__/promise-component.spec.tsx (deleted), frontend/public/components/utils/index.tsx |
Deleted the PromiseComponent class and its state type, removed its unit tests, and removed the export * from './promise-component'; re-export from the utils barrel. |
Lazy import path updates frontend/public/components/build.tsx, frontend/public/components/daemon-set.tsx, frontend/public/components/deployment-config.tsx, frontend/public/components/deployment.tsx, frontend/public/components/pod.tsx, frontend/public/components/replicaset.jsx, frontend/public/components/replication-controller.jsx, frontend/public/components/stateful-set.tsx |
Updated dynamic imports to load the environment module from ./environment (removed explicit .jsx extension) to match the new module file. |
i18n changes frontend/public/locales/en/public.json |
Added "owners:" translation entry and removed two stale page-staleness entries. |
Test / CI tweak frontend/packages/integration-tests-cypress/tests/crud/secrets/image-pull.cy.ts |
Replaced cy.deleteProjectWithCLI(testName) with cy.exec(\oc delete project ${testName} --wait=false`)` in test cleanup. |
Misc tests & small fixes frontend/public/components/__tests__/pod.spec.tsx |
Adjusted test selectors to use getAllByText and widened the time regex to accept alternate values; assertions otherwise unchanged. |
Integration test view tweak frontend/packages/integration-tests-cypress/views/secret.ts |
Changed a dropdown item interaction to click({ force: true }) to ensure selection in the secrets UI test helper. |
Estimated code review effort
๐ฏ 5 (Critical) | โฑ๏ธ ~120 minutes
- Focus review on:
frontend/public/components/environment.tsxโ CurrentEnvVars transformations, patch generation (create vs update), RBAC checks, on-demand resource loading, and correctness of generated Kubernetes patches/payloads.frontend/public/components/modals/configure-ns-pull-secret-modal.tsxโgenerateSecretDatacorrectness, base64 encoding, Secret object shape, and ServiceAccount patch semantics.- Modal migrations โ ensure
usePromiseHandlerreproduces previous PromiseComponent behavior (inProgress, errorMessage, rejection propagation) and Formik integration correctness. - Remove/replace occurrences of the deleted
promise-component(imports, barrels, tests) to avoid dangling references.
โจ 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.
/jira refresh
@krishagarwal278: This pull request references CONSOLE-4712 which is a valid jira issue.
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.
@krishagarwal278: This pull request references CONSOLE-4712 which is a valid jira issue.
In response to this:
Summary
Tech Debt
This PR aims to remove PromiseComponent and convert its dependent components to function components.
Checklist:
- [X] Remove PromiseComponent and its test
- [X] Convert its dependent components to function components using
usePromiseHandlerfor promise action. Number of files/components: 8- [X] Components refactored(6/6):
EditApplicationModal, MoveConnectionModal, DeleteResourceModal, ConfirmModal, ConfigureNamespacePullSecret, Environment
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.
@krishagarwal278: This pull request references CONSOLE-4712 which is a valid jira issue.
In response to this:
Summary
Tech Debt
This PR aims to remove PromiseComponent and convert its dependent components to function components.
Checklist:
- [X] Remove PromiseComponent and its test
- [X] Convert its dependent components to function components using
usePromiseHandlerfor promise action. Number of files/components: 8- [X] Components refactored(6/6):
EditApplicationModal, MoveConnectionModal, DeleteResourceModal, ConfirmModal, ConfigureNamespacePullSecret, Environment- [X] Verified locally as seen on shared cluster that all refactored components/modals are working as expected
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.
@krishagarwal278: This pull request references CONSOLE-4712 which is a valid jira issue.
In response to this:
Summary
Tech Debt
This PR aims to remove PromiseComponent and convert its dependent components to function components.
Checklist:
- [X] Remove PromiseComponent and its test
- [X] Convert its dependent components to function components using
usePromiseHandlerfor promise action. Number of files/components: 8- [X] Components refactored(6/6):
EditApplicationModal, MoveConnectionModal, DeleteResourceModal, ConfirmModal, ConfigureNamespacePullSecret, Environment- [X] Verified that
usePromiseHandlerhook provides the same promise handling behavior as the oldPromiseComponentclass
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.
/label px-approved /label docs-approved
/retest
/label tide/merge-method-squash
/verified later @yapei @yanpzhan
@krishagarwal278: This PR has been marked to be verified later by @yapei @yanpzhan.
In response to this:
/verified later @yapei @yanpzhan
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.
/retest-required
Remaining retests: 0 against base HEAD 2243c0611dd1c08b078c8d04cf6cf08fb6a927a0 and 2 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
/retest-required
Remaining retests: 0 against base HEAD 229604a0050c4c537344bb8be70743062c8b2aee and 1 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
/test e2e-gcp-console
/retest-required
Remaining retests: 0 against base HEAD c6881d1ca4c1ff37b61bfe6a7fe448d5f0beee7d and 0 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
This looks good! ๐
QE Approver: /assign @yapei
/hold
Revision 3004a0857769b29ad8615430aaecbedba65ef738 was retested 3 times: holding
/unhold
/retest-required
Remaining retests: 0 against base HEAD 846beeb42703e54a4a388c9de263cfd6e376bdc1 and 2 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
/retest-required
Remaining retests: 0 against base HEAD 24ccbf9675c24a8089a91cc31cd404c37e3d8d85 and 1 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
covered following scenarios in PR testing
- Workloads -> Environment tab, Add/Edit/Delete env vars
- Delete resources
- Edit Application group and drag node into and out of application, confirm and cancel
no regression issues found /verified by @yapei
@yapei: This PR has been marked as verified by @yapei.
In response to this:
covered following scenarios in PR testing
- Workloads -> Environment tab, Add/Edit/Delete env vars
- Delete resources
- Edit Application group and drag node into and out of application, confirm and cancel
no regression issues found /verified by @yapei
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.
/retest-required
Remaining retests: 0 against base HEAD 971f0fa6bf7a7b762bf59ab5171aa5c04147fd09 and 0 for PR HEAD 3004a0857769b29ad8615430aaecbedba65ef738 in total
/hold
Revision 3004a0857769b29ad8615430aaecbedba65ef738 was retested 3 times: holding
/retest-required
/retest
/unhold
/lgtm
re-verified with latest changes /verified by @yapei