Skip to content

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Jan 21, 2026

Summary

This PR continues the migration of modals from the legacy createModalLauncher pattern to the new OverlayComponent pattern using the useOverlay hook.

Note: This PR builds on:

This PR includes only the following new modal migrations:

New Modals Migrated (3)

  1. ConfigureUnschedulableModal - Used for marking nodes as unschedulable

    • Updated: packages/console-app/src/components/nodes/modals/ConfigureUnschedulableModal.tsx
    • Updated: packages/console-app/src/components/nodes/menu-actions.tsx
  2. DeletePDBModal - Used for removing PodDisruptionBudgets from workloads

    • Updated: packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx
    • Updated: packages/console-app/src/actions/hooks/usePDBActions.ts
  3. ResourceLimitsModal - Used for editing resource limits on deployments

    • Updated: packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
    • Updated: packages/console-app/src/actions/hooks/useDeploymentActions.ts

Changes Made

For each modal:

  • Removed createModalLauncher usage
  • Added OverlayComponent and ModalWrapper imports
  • Exported modal as [Name]Provider wrapping content in ModalWrapper
  • Updated index files to use React.lazy() for code splitting
  • Updated action hooks to use useOverlay() hook with launchModal()
  • Added appropriate ESLint disable comments for launchModal dependencies where needed

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced modal dialog system with improved rendering and accessibility support.
  • Bug Fixes

    • Improved modal accessibility handling during component initialization and loading states.

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

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

openshift-ci-robot commented Jan 21, 2026

@rhamilto: This pull request references CONSOLE-5012 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

This PR continues the migration of modals from the legacy createModalLauncher pattern to the new OverlayComponent pattern using the useOverlay hook.

Note: This PR builds on:

This PR includes only the following new modal migrations:

New Modals Migrated (2)

  1. DeletePDBModal - Used for removing PodDisruptionBudgets from workloads
  • Updated: packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx
  • Updated: packages/console-app/src/actions/hooks/usePDBActions.ts
  1. ResourceLimitsModal - Used for editing resource limits on deployments
  • Updated: packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
  • Updated: packages/console-app/src/actions/hooks/useDeploymentActions.ts

Changes Made

For each modal:

  • Removed createModalLauncher usage
  • Added OverlayComponent and ModalWrapper imports
  • Exported modal as [Name]Provider wrapping content in ModalWrapper
  • Updated index files to use React.lazy() for code splitting
  • Updated action hooks to use useOverlay() hook with launchModal()
  • Added appropriate ESLint disable comments for launchModal dependencies where needed

🤖 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 component/core Related to console core functionality label Jan 21, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 21, 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/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/knative Related to knative-plugin component/sdk Related to console-plugin-sdk labels Jan 21, 2026
@rhamilto rhamilto changed the title CONSOLE-5012: Additional modal migrations to overlay pattern [WIP] CONSOLE-5012: Additional modal migrations to overlay pattern Jan 21, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 21, 2026

@rhamilto: This pull request references CONSOLE-5012 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

This PR continues the migration of modals from the legacy createModalLauncher pattern to the new OverlayComponent pattern using the useOverlay hook.

Note: This PR builds on:

This PR includes only the following new modal migrations:

New Modals Migrated (3)

  1. ConfigureUnschedulableModal - Used for marking nodes as unschedulable
  • Updated: packages/console-app/src/components/nodes/modals/ConfigureUnschedulableModal.tsx
  • Updated: packages/console-app/src/components/nodes/menu-actions.tsx
  • Commit: f9dc835
  1. DeletePDBModal - Used for removing PodDisruptionBudgets from workloads
  • Updated: packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx
  • Updated: packages/console-app/src/actions/hooks/usePDBActions.ts
  1. ResourceLimitsModal - Used for editing resource limits on deployments
  • Updated: packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
  • Updated: packages/console-app/src/actions/hooks/useDeploymentActions.ts

Changes Made

For each modal:

  • Removed createModalLauncher usage
  • Added OverlayComponent and ModalWrapper imports
  • Exported modal as [Name]Provider wrapping content in ModalWrapper
  • Updated index files to use React.lazy() for code splitting
  • Updated action hooks to use useOverlay() hook with launchModal()
  • Added appropriate ESLint disable comments for launchModal dependencies where needed

🤖 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 Jan 21, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 21, 2026

@rhamilto: This pull request references CONSOLE-5012 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

This PR continues the migration of modals from the legacy createModalLauncher pattern to the new OverlayComponent pattern using the useOverlay hook.

Note: This PR builds on:

This PR includes only the following new modal migrations:

New Modals Migrated (3)

  1. ConfigureUnschedulableModal - Used for marking nodes as unschedulable
  • Updated: packages/console-app/src/components/nodes/modals/ConfigureUnschedulableModal.tsx
  • Updated: packages/console-app/src/components/nodes/menu-actions.tsx
  1. DeletePDBModal - Used for removing PodDisruptionBudgets from workloads
  • Updated: packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx
  • Updated: packages/console-app/src/actions/hooks/usePDBActions.ts
  1. ResourceLimitsModal - Used for editing resource limits on deployments
  • Updated: packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
  • Updated: packages/console-app/src/actions/hooks/useDeploymentActions.ts

Changes Made

For each modal:

  • Removed createModalLauncher usage
  • Added OverlayComponent and ModalWrapper imports
  • Exported modal as [Name]Provider wrapping content in ModalWrapper
  • Updated index files to use React.lazy() for code splitting
  • Updated action hooks to use useOverlay() hook with launchModal()
  • Added appropriate ESLint disable comments for launchModal dependencies where needed

🤖 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-robot
Copy link
Contributor

openshift-ci-robot commented Jan 21, 2026

@rhamilto: This pull request references CONSOLE-5012 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

This PR continues the migration of modals from the legacy createModalLauncher pattern to the new OverlayComponent pattern using the useOverlay hook.

Note: This PR builds on:

This PR includes only the following new modal migrations:

New Modals Migrated (3)

  1. ConfigureUnschedulableModal - Used for marking nodes as unschedulable
  • Updated: packages/console-app/src/components/nodes/modals/ConfigureUnschedulableModal.tsx
  • Updated: packages/console-app/src/components/nodes/menu-actions.tsx
  1. DeletePDBModal - Used for removing PodDisruptionBudgets from workloads
  • Updated: packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx
  • Updated: packages/console-app/src/actions/hooks/usePDBActions.ts
  1. ResourceLimitsModal - Used for editing resource limits on deployments
  • Updated: packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
  • Updated: packages/console-app/src/actions/hooks/useDeploymentActions.ts

Changes Made

For each modal:

  • Removed createModalLauncher usage
  • Added OverlayComponent and ModalWrapper imports
  • Exported modal as [Name]Provider wrapping content in ModalWrapper
  • Updated index files to use React.lazy() for code splitting
  • Updated action hooks to use useOverlay() hook with launchModal()
  • Added appropriate ESLint disable comments for launchModal dependencies where needed

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

  • Enhanced modal dialog system with improved rendering and accessibility support.

  • Bug Fixes

  • Improved modal accessibility handling during component initialization and loading states.

✏️ 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

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the modal system across the console application to use a provider-based overlay pattern instead of direct modal launchers. Action hooks are converted to React hooks (e.g., DeleteApplicationAction → useDeleteApplicationAction), and modal invocations migrate from createModalLauncher to overlay-based launchModal calls with lazy-loaded provider components. Modal components are wrapped in ModalWrapper with OverlayComponent type signatures, and Suspense boundaries are added to OverlayProvider for handling lazy-loaded modals. The changes affect action hooks, modal provider files, and modal index exports across the console-app, dev-console, and knative-plugin packages, plus updates to public modal utilities and factory code.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately summarizes the main objective: migrating modals to an overlay pattern, which is reflected throughout the changeset.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@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: 3

Caution

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

⚠️ Outside diff range comments (2)
frontend/packages/console-app/src/components/pdb/modals/DeletePDBModal.tsx (1)

26-41: Spinner persists indefinitely on error.

When k8sKill fails, setIsSubmitting(true) is never reset to false. The user sees an endless spinner alongside the error message, with no way to retry or dismiss cleanly.

🐛 Proposed fix
     k8sKill(PodDisruptionBudgetModel, pdb)
       .then(() => {
         close();
       })
       .catch((error) => {
+        setIsSubmitting(false);
         setSubmitError(
           error?.message ||
             t('console-app~Unknown error removing PodDisruptionBudget {{pdbName}}.', {
               pdbName,
             }),
         );
       });
frontend/public/components/modals/delete-pvc-modal.tsx (1)

41-42: Minor typo in comment.

Small typo: "resourcce" should be "resource".

📝 Proposed fix
-      // Redirect to resourcce list page if the resouce is deleted.
+      // Redirect to resource list page if the resource is deleted.
🤖 Fix all issues with AI agents
In `@frontend/packages/dev-console/src/actions/context-menu.ts`:
- Around line 24-38: The onSubmit handler passed to deleteResourceModal assumes
application.resources is always an array and calls forEach, which will throw if
undefined; update the onSubmit in the deleteResourceModal call to guard against
missing resources by iterating over (application.resources || []) or using
optional chaining (application.resources?.forEach) so cleanUpWorkload is only
called when resources exist and Promise.all is still returned (for an empty
array when there are no resources).

In `@frontend/packages/knative-plugin/src/actions/creators.ts`:
- Around line 4-5: The import of useOverlay in creators.ts uses an internal
path; update the import to use the public re-export from
`@console/dynamic-plugin-sdk` by replacing the existing import that references
'@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay' with an import
from '@console/dynamic-plugin-sdk' so that the useOverlay symbol is consumed
from the public API surface (ensure any other imports in this file remain
unchanged, and keep LazyDeleteModalProvider import as-is).
- Around line 120-153: Add the missing ESLint disable comment before the
dependency array in the useDeleteKnativeServiceResource hook: place the line "//
eslint-disable-next-line react-hooks/exhaustive-deps" immediately above the
dependency array that currently lists [kind, obj, serviceTypeValue,
serviceCreatedFromWebFlag, launchModal] so the hook matches the pattern used by
useSetTrafficDistributionAction, useMoveSinkPubsubAction, and
useDeleteRevisionAction.
🧹 Nitpick comments (8)
frontend/packages/knative-plugin/src/actions/providers.ts (1)

98-150: Simplify delete action selection to avoid creating unused actions.

You can compute the “generated-by” flag once and call useDeleteKnativeServiceResource a single time. This reduces duplicate action objects and trims the dependency list.

♻️ Suggested refactor
-  const deleteKnativeServiceFromWebAction = useDeleteKnativeServiceResource(
-    kindObj,
-    resource,
-    serviceTypeValue,
-    true,
-  );
-  const deleteKnativeServiceAction = useDeleteKnativeServiceResource(
-    kindObj,
-    resource,
-    serviceTypeValue,
-    false,
-  );
+  const serviceCreatedFromWebConsole =
+    resource.metadata.annotations?.['openshift.io/generated-by'] === 'OpenShiftWebConsole';
+  const deleteKnativeServiceAction = useDeleteKnativeServiceResource(
+    kindObj,
+    resource,
+    serviceTypeValue,
+    serviceCreatedFromWebConsole,
+  );
@@
-            ...(resource.metadata.annotations?.['openshift.io/generated-by'] ===
-            'OpenShiftWebConsole'
-              ? [deleteKnativeServiceFromWebAction]
-              : [deleteKnativeServiceAction]),
+            deleteKnativeServiceAction,
@@
-      deleteKnativeServiceFromWebAction,
-      deleteKnativeServiceAction,
+      deleteKnativeServiceAction,
frontend/packages/console-app/src/components/modals/clone/clone-pvc-modal.tsx (1)

11-18: Prefer extracting closeOverlay before passing props.

Passing {...props} last can let caller-supplied cancel/close override the overlay wiring; extracting closeOverlay keeps it explicit and avoids leaking it into the inner modal. If you keep the current ordering, please confirm no launchModal callers pass cancel/close.

♻️ Proposed refactor
-export const ClonePVCModalProvider: OverlayComponent<ClonePVCModalProps> = (props) => {
-  return (
-    <ModalWrapper blocking onClose={props.closeOverlay}>
-      <ClonePVCModal cancel={props.closeOverlay} close={props.closeOverlay} {...props} />
-    </ModalWrapper>
-  );
-};
+export const ClonePVCModalProvider: OverlayComponent<ClonePVCModalProps> = ({
+  closeOverlay,
+  ...rest
+}) => {
+  return (
+    <ModalWrapper blocking onClose={closeOverlay}>
+      <ClonePVCModal {...rest} cancel={closeOverlay} close={closeOverlay} />
+    </ModalWrapper>
+  );
+};

Also applies to: 279-288

frontend/public/components/modals/rollback-modal.jsx (1)

8-8: Prefer extracting closeOverlay before passing props.

Passing {...props} last can let caller-supplied cancel/close override the overlay wiring; extracting closeOverlay keeps it explicit and avoids leaking it into the inner modal. If you keep the current ordering, please confirm no launchModal callers pass cancel/close.

♻️ Proposed refactor
-export const RollbackModalProvider = (props) => {
-  return (
-    <ModalWrapper blocking onClose={props.closeOverlay}>
-      <BaseRollbackModal cancel={props.closeOverlay} close={props.closeOverlay} {...props} />
-    </ModalWrapper>
-  );
-};
+export const RollbackModalProvider = ({ closeOverlay, ...rest }) => {
+  return (
+    <ModalWrapper blocking onClose={closeOverlay}>
+      <BaseRollbackModal {...rest} cancel={closeOverlay} close={closeOverlay} />
+    </ModalWrapper>
+  );
+};

Also applies to: 217-226

frontend/packages/console-app/src/components/modals/resource-limits/index.ts (1)

4-10: Lazy loading correctly configured, though transformation is redundant.

The React.lazy wrapper with webpackChunkName is correctly set up for code splitting. However, the .then((m) => ({ default: m.default })) transformation is unnecessary—React.lazy already expects a module with a default export, which ResourceLimitsModalLauncher.tsx provides directly.

This pattern appears intentional for consistency across the migration, so no action required, but for future reference:

♻️ Simplified version (optional)
 export const LazyResourceLimitsModalProvider = lazy(() =>
-  import('./ResourceLimitsModalLauncher' /* webpackChunkName: "resource-limits-modal" */).then(
-    (m) => ({
-      default: m.default,
-    }),
-  ),
+  import('./ResourceLimitsModalLauncher' /* webpackChunkName: "resource-limits-modal" */),
 );
frontend/packages/console-app/src/actions/hooks/usePDBActions.ts (1)

101-103: Same launchModal dependency concern as useReplicaSetActions.ts.

This follows the same pattern of omitting launchModal from dependencies. For consistency across the codebase, consider addressing this uniformly — either document why it's safe to omit here but not in useCommonActions.ts, or investigate the root cause of the "max depth exceeded" issue.

frontend/packages/console-app/src/actions/hooks/useReplicationControllerActions.ts (1)

98-100: Verify hook dependency suppression remains safe with launchModal.
If useOverlay() or useWarningModal() return unstable callbacks, excluding them can create stale closures. Please confirm stability or wrap them (e.g., useCallback/useEvent) to keep deps accurate without the depth-error.

frontend/packages/console-app/src/components/nodes/menu-actions.tsx (1)

73-85: Avoid suppressing hook deps for launchModal.
If useOverlay is stable, include it in the deps and drop the eslint disable. If it isn’t, consider stabilizing it (or wrapping via a ref) so the memo can safely depend on it without churn.

frontend/packages/console-app/src/components/nodes/modals/ConfigureUnschedulableModal.tsx (1)

51-60: Prevent caller props from overriding overlay close handlers.

In JSX, {...props} after explicit prop assignments will override them. Since ModalComponentProps includes optional cancel and close fields, a caller could pass these props and override the closeOverlay assignment, leaving the overlay open. While current usage ({ resource: obj }) doesn't trigger this, the provider should defensively control its own lifecycle.

Destructure closeOverlay and spread the rest of props after the explicit handlers:

♻️ Suggested adjustment
-export const ConfigureUnschedulableModalProvider: OverlayComponent<ConfigureUnschedulableModalProps> = (
-  props,
-) => (
-  <ModalWrapper blocking onClose={props.closeOverlay}>
-    <ConfigureUnschedulableModal
-      cancel={props.closeOverlay}
-      close={props.closeOverlay}
-      {...props}
-    />
-  </ModalWrapper>
-);
+export const ConfigureUnschedulableModalProvider: OverlayComponent<ConfigureUnschedulableModalProps> = (
+  props,
+) => {
+  const { closeOverlay, ...rest } = props;
+  return (
+    <ModalWrapper blocking onClose={closeOverlay}>
+      <ConfigureUnschedulableModal cancel={closeOverlay} close={closeOverlay} {...rest} />
+    </ModalWrapper>
+  );
+};

Comment on lines 24 to 38
return {
id: 'delete-application',
label: t('devconsole~Delete application'),
cta: () => {
const reqs = [];
deleteResourceModal({
blocking: true,
resourceName: application.name,
resourceType: ApplicationModel.label,
onSubmit: () => {
application.resources.forEach((resource) => {
reqs.push(cleanUpWorkload(resource.resource));
});
return Promise.all(reqs);
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard against missing application.resources before iterating.

application.resources is treated as optional elsewhere, but forEach will throw if it’s undefined. This can break delete for apps without resources.

✅ Suggested fix
-      cta: () => {
-        const reqs = [];
-        deleteResourceModal({
-          blocking: true,
-          resourceName: application.name,
-          resourceType: ApplicationModel.label,
-          onSubmit: () => {
-            application.resources.forEach((resource) => {
-              reqs.push(cleanUpWorkload(resource.resource));
-            });
-            return Promise.all(reqs);
-          },
-        });
-      },
+      cta: () => {
+        deleteResourceModal({
+          blocking: true,
+          resourceName: application.name,
+          resourceType: ApplicationModel.label,
+          onSubmit: () => {
+            const resources = application.resources ?? [];
+            return Promise.all(
+              resources.map((resource) => cleanUpWorkload(resource.resource)),
+            );
+          },
+        });
+      },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
id: 'delete-application',
label: t('devconsole~Delete application'),
cta: () => {
const reqs = [];
deleteResourceModal({
blocking: true,
resourceName: application.name,
resourceType: ApplicationModel.label,
onSubmit: () => {
application.resources.forEach((resource) => {
reqs.push(cleanUpWorkload(resource.resource));
});
return Promise.all(reqs);
},
return {
id: 'delete-application',
label: t('devconsole~Delete application'),
cta: () => {
deleteResourceModal({
blocking: true,
resourceName: application.name,
resourceType: ApplicationModel.label,
onSubmit: () => {
const resources = application.resources ?? [];
return Promise.all(
resources.map((resource) => cleanUpWorkload(resource.resource)),
);
},
});
},
🤖 Prompt for AI Agents
In `@frontend/packages/dev-console/src/actions/context-menu.ts` around lines 24 -
38, The onSubmit handler passed to deleteResourceModal assumes
application.resources is always an array and calls forEach, which will throw if
undefined; update the onSubmit in the deleteResourceModal call to guard against
missing resources by iterating over (application.resources || []) or using
optional chaining (application.resources?.forEach) so cleanUpWorkload is only
called when resources exist and Promise.all is still returned (for an empty
array when there are no resources).

Comment on lines +4 to +5
import { useOverlay } from '@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay';
import { LazyDeleteModalProvider } from '@console/internal/components/modals';
Copy link

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:

#!/bin/bash
# Find the main entry point of dynamic-plugin-sdk and check exports
echo "=== Checking dynamic-plugin-sdk package structure ==="
fd -t f "package.json" | grep "console-dynamic-plugin-sdk" | head -5

# Find the index or main entry files
echo "=== Looking for index files in dynamic-plugin-sdk ==="
find . -path "*/console-dynamic-plugin-sdk/src/*" -name "index.ts" -o -name "index.js" | head -20

Repository: openshift/console

Length of output: 178


🏁 Script executed:

#!/bin/bash
# Search for useOverlay exports in the dynamic-plugin-sdk
echo "=== Searching for useOverlay exports ==="
rg "export.*useOverlay" frontend/packages/console-dynamic-plugin-sdk/src/ -n --type ts

# Also check the specific modal-support directory
echo "=== Checking modal-support directory ==="
find frontend/packages/console-dynamic-plugin-sdk/src/app/modal-support -type f -name "*.ts*" 2>/dev/null | head -20

Repository: openshift/console

Length of output: 751


🏁 Script executed:

#!/bin/bash
# Check how other files in knative-plugin import from dynamic-plugin-sdk
echo "=== Checking import patterns in knative-plugin ==="
rg "from '@console/dynamic-plugin-sdk" frontend/packages/knative-plugin/src/ -n --type ts | head -30

Repository: openshift/console

Length of output: 5332


Import useOverlay from the public API surface.

useOverlay is re-exported from @console/dynamic-plugin-sdk in the public API (dynamic-core-api.ts). Import it from @console/dynamic-plugin-sdk directly, consistent with other public hooks like useActivePerspective, rather than reaching into the internal /src/ path.

Change:

import { useOverlay } from '@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay';

to:

import { useOverlay } from '@console/dynamic-plugin-sdk';
🤖 Prompt for AI Agents
In `@frontend/packages/knative-plugin/src/actions/creators.ts` around lines 4 - 5,
The import of useOverlay in creators.ts uses an internal path; update the import
to use the public re-export from `@console/dynamic-plugin-sdk` by replacing the
existing import that references
'@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay' with an import
from '@console/dynamic-plugin-sdk' so that the useOverlay symbol is consumed
from the public API surface (ensure any other imports in this file remain
unchanged, and keep LazyDeleteModalProvider import as-is).

Comment on lines 120 to 155
export const useDeleteKnativeServiceResource = (
kind: K8sKind,
obj: K8sResourceKind,
serviceTypeValue: ServiceTypeValue,
serviceCreatedFromWebFlag: boolean,
): Action => ({
id: `delete-resource`,
label:
serviceTypeValue === ServiceTypeValue.Function
? i18next.t('knative-plugin~Delete Function')
: i18next.t('knative-plugin~Delete Service'),
cta: () =>
deleteModal(
serviceCreatedFromWebFlag
? {
kind,
resource: obj,
deleteAllResources: () => cleanUpWorkload(obj),
}
: {
kind,
resource: obj,
},
),
accessReview: asAccessReview(kind, obj, 'delete'),
});
): Action => {
const launchModal = useOverlay();

return useMemo<Action>(
() => ({
id: `delete-resource`,
label:
serviceTypeValue === ServiceTypeValue.Function
? i18next.t('knative-plugin~Delete Function')
: i18next.t('knative-plugin~Delete Service'),
cta: () =>
launchModal(
LazyDeleteModalProvider,
serviceCreatedFromWebFlag
? {
kind,
resource: obj,
deleteAllResources: () => cleanUpWorkload(obj),
}
: {
kind,
resource: obj,
},
),
accessReview: asAccessReview(kind, obj, 'delete'),
}),
[kind, obj, serviceTypeValue, serviceCreatedFromWebFlag, launchModal],
);
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for old function name - should find zero results if rename is complete
echo "=== Searching for old function name 'deleteKnativeServiceResource' ==="
rg -n "deleteKnativeServiceResource[^_]" --type ts frontend/ || echo "No matches found (as expected)"

echo ""
echo "=== Searching for new hook name usage ==="
rg -n "useDeleteKnativeServiceResource" --type ts frontend/ -A 2

echo ""
echo "=== Checking dependency arrays in related hooks ==="
echo "Checking useSetTrafficDistributionAction:"
rg -n "useSetTrafficDistributionAction" --type ts frontend/ -A 30 | head -50

echo ""
echo "Checking useDeleteRevisionAction:"
rg -n "useDeleteRevisionAction" --type ts frontend/ -A 30 | head -50

Repository: openshift/console

Length of output: 10992


🏁 Script executed:

#!/bin/bash
# Now let's examine the actual dependency arrays in the creators.ts file
echo "=== Viewing the creators.ts file with focus on dependency arrays ==="
cat -n frontend/packages/knative-plugin/src/actions/creators.ts | sed -n '1,80p'

echo ""
echo "=== Viewing useSetTrafficDistributionAction dependency array ==="
rg -n "useSetTrafficDistributionAction" --type ts frontend/packages/knative-plugin/src/actions/creators.ts -A 35 | head -50

echo ""
echo "=== Viewing useDeleteRevisionAction dependency array ==="
rg -n "useDeleteRevisionAction" --type ts frontend/packages/knative-plugin/src/actions/creators.ts -A 35 | head -50

echo ""
echo "=== Viewing useDeleteKnativeServiceResource dependency array (full function) ==="
rg -n "useDeleteKnativeServiceResource" --type ts frontend/packages/knative-plugin/src/actions/creators.ts -A 35

Repository: openshift/console

Length of output: 8489


Rename is complete—add the missing eslint-disable comment for consistency.

The migration to useDeleteKnativeServiceResource is properly implemented with both call sites in useKnativeServiceActionsProvider correctly updated. However, this function is missing the // eslint-disable-next-line react-hooks/exhaustive-deps comment that appears on every other action hook creator in this file (useSetTrafficDistributionAction, useMoveSinkPubsubAction, useDeleteRevisionAction, etc.). Add the disable comment before the dependency array on line 151 to align with the established pattern:

    ),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [kind, obj, serviceTypeValue, serviceCreatedFromWebFlag, launchModal],
🤖 Prompt for AI Agents
In `@frontend/packages/knative-plugin/src/actions/creators.ts` around lines 120 -
153, Add the missing ESLint disable comment before the dependency array in the
useDeleteKnativeServiceResource hook: place the line "//
eslint-disable-next-line react-hooks/exhaustive-deps" immediately above the
dependency array that currently lists [kind, obj, serviceTypeValue,
serviceCreatedFromWebFlag, launchModal] so the hook matches the pattern used by
useSetTrafficDistributionAction, useMoveSinkPubsubAction, and
useDeleteRevisionAction.

rhamilto and others added 11 commits January 21, 2026 13:30
Migrates PVC-related modals (expand, clone, delete, restore) from the
legacy createModalLauncher pattern to the modern OverlayComponent pattern
with lazy loading.

Changes include:
- Convert modal exports to OverlayComponent providers
- Implement lazy loading for modal components
- Update action hooks to use useOverlay() and launchModal()
- Set react-modal app element globally in App component
- Maintain backward compatibility with existing modal exports

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit completes the migration from createModalLauncher to the
OverlayComponent pattern for delete modals and related actions.

Changes:
- Refactored delete-modal.tsx to use OverlayComponent pattern
- Added LazyDeleteModalProvider with React.lazy() for code splitting
- Converted action creators to hooks to comply with React rules:
  * DeleteResourceAction → useDeleteResourceAction (context-menu.ts)
  * deleteKnativeServiceResource → useDeleteKnativeServiceResource (creators.ts)
- Updated all consumers to use new hook-based actions:
  * useCommonActions - uses LazyDeleteModalProvider with launchModal
  * deployment-provider - uses useDeleteResourceAction hook
  * deploymentconfig-provider - uses useDeleteResourceAction hook
  * knative-plugin providers - uses useDeleteKnativeServiceResource hook
- Updated public/components/modals/index.ts with lazy export
- Eliminated all deleteModal() function calls

Note: DeleteApplicationAction remains as a non-hook function creator
since it doesn't use modals and doesn't need to comply with hooks rules.

This change maintains backward compatibility through default exports
and preserves lazy loading functionality.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove launchModal from dependency arrays in pre-existing hooks to
prevent infinite loops. These files were not modified as part of the
modal migration work, but had the same issue.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit refactors configure-update-strategy-modal to use the
OverlayComponent pattern, eliminating createModalLauncher.

Changes:
- Refactored configure-update-strategy-modal.tsx to use OverlayComponent
- Added ConfigureUpdateStrategyModalProvider with ModalWrapper
- Added LazyConfigureUpdateStrategyModalProvider with React.lazy()
- Updated useDeploymentActions to use the new lazy provider
- Removed deprecated configureUpdateStrategyModal from index.ts

This change maintains backward compatibility through default exports
and preserves lazy loading functionality.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit migrates the configure namespace pull secret modal from the
legacy createModalLauncher pattern to the new OverlayComponent pattern.

Changes:
- Exported ConfigureNamespacePullSecretModalProvider as OverlayComponent
- Updated index.ts to lazy-load the modal provider
- Modified namespace.jsx to use useOverlay hook instead of direct modal call

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

This commit migrates the configure cluster upstream modal from the legacy
createModalLauncher pattern to the new OverlayComponent pattern and fixes
react-modal accessibility warnings.

Changes:
- Exported ConfigureClusterUpstreamModalProvider as OverlayComponent
- Updated index.ts to lazy-load the modal provider
- Modified details-page.tsx to use useOverlay hook instead of direct modal call
- Removed unnecessary TFunction prop from modal type definition
- Fixed react-modal warnings by using useLayoutEffect for global app element setup
- Added explicit appElement prop to ModalWrapper for robust timing handling

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit migrates the managed resource save modal from the legacy
createModalLauncher pattern to the new OverlayComponent pattern.

Changes:
- Exported ManagedResourceSaveModalProvider as OverlayComponent
- Updated index.ts to lazy-load the modal provider
- Modified edit-yaml.tsx to use useOverlay hook instead of direct modal call
- Removed unnecessary 'kind' prop from modal invocation
- Updated type definition to extend ModalComponentProps

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The remove-user-modal was already replaced by useWarningModal in
group.tsx and is no longer used anywhere in the codebase.

Changes:
- Deleted remove-user-modal.tsx
- Removed LazyRemoveUserModalProvider export from index.ts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit migrates the ConfigureUnschedulableModal from the legacy
createModalLauncher pattern to the new OverlayComponent pattern.

Changes:
- Exported ConfigureUnschedulableModalProvider as OverlayComponent
- Updated modals/index.ts to lazy-load the modal provider
- Modified useNodeActions hook to use useOverlay hook
- Removed createModalLauncher usage

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

openshift-ci bot commented Jan 22, 2026

@rhamilto: 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.

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/sdk Related to console-plugin-sdk 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants