-
Notifications
You must be signed in to change notification settings - Fork 666
CONSOLE-3769: More openshift/dynamic-plugin-sdk prep work #15738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CONSOLE-3769: More openshift/dynamic-plugin-sdk prep work #15738
Conversation
|
@logonoff: This pull request references CONSOLE-3769 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 either version "4.21." or "openshift-4.21.", but it targets "openshift-4.15" instead. In response to this:
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 |
23217fa to
3840f6e
Compare
WalkthroughThis PR normalizes plugin status strings from capitalized to lowercase ('Loaded'/'Pending'/'Failed' → 'loaded'/'pending'/'failed'), refactors the usePluginInfo hook to return a direct array instead of a tuple, removes status-checking helper predicates, eliminates i18nNamespaces handling from PluginStore, and updates related type signatures and consumers throughout the codebase. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (1)**⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (2)frontend/public/components/notification-drawer.tsx (1)
frontend/packages/console-plugin-sdk/src/store.ts (1)
🔇 Additional comments (3)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
frontend/public/components/notification-drawer.tsx (1)
165-165: Consider adding optional chaining for consistency.While the filter at line 165 uses
plugin.status === 'failed', other files in this PR use optional chaining (plugin?.status). For consistency and defensive coding, consider:- const failedPlugins = pluginInfoEntries.filter((plugin) => plugin.status === 'failed'); + const failedPlugins = pluginInfoEntries.filter((plugin) => plugin?.status === 'failed');frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx (1)
21-26: Inconsistent optional chaining usage.Lines 21 and 26 use optional chaining (
plugin?.status), but lines 24-25 don't. While the logic may work sincenotLoadedDynamicPluginInfoalready filtered out invalid entries, using consistent optional chaining improves code safety and readability.const notLoadedDynamicPluginInfo = pluginInfoEntries.filter( (plugin) => plugin?.status !== 'loaded', ); - const failedPlugins = notLoadedDynamicPluginInfo.filter((plugin) => plugin.status === 'failed'); - const pendingPlugins = notLoadedDynamicPluginInfo.filter((plugin) => plugin.status === 'pending'); + const failedPlugins = notLoadedDynamicPluginInfo.filter((plugin) => plugin?.status === 'failed'); + const pendingPlugins = notLoadedDynamicPluginInfo.filter((plugin) => plugin?.status === 'pending'); const loadedPlugins = pluginInfoEntries.filter((plugin) => plugin?.status === 'loaded');frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (1)
338-365: Consider more explicit status filtering for clarity.Line 342 uses
p?.status !== 'loaded'to find non-loaded plugins, which matches both 'pending' and 'failed' statuses. While functionally correct, an explicit check would improve readability:- const notLoadedPluginInfo = pluginInfo - .filter((p) => p?.status !== 'loaded') - .find((i) => i?.pluginName === pluginName); + const notLoadedPluginInfo = pluginInfo + .filter((p) => p?.status === 'pending' || p?.status === 'failed') + .find((i) => i?.pluginName === pluginName);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (18)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx(10 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts(1 hunks)frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts(1 hunks)frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts(6 hunks)frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts(3 hunks)frontend/packages/console-plugin-sdk/src/store.ts(5 hunks)frontend/public/components/about-modal.tsx(1 hunks)frontend/public/components/app-contents.tsx(1 hunks)frontend/public/components/notification-drawer.tsx(3 hunks)frontend/public/i18n.js(1 hunks)frontend/public/plugins.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/public/i18n.jsfrontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsxfrontend/public/components/app-contents.tsxfrontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsxfrontend/packages/console-plugin-sdk/src/__tests__/store.spec.tsfrontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.tsfrontend/public/plugins.tsfrontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsxfrontend/packages/console-plugin-sdk/src/store.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsxfrontend/public/components/about-modal.tsxfrontend/public/components/notification-drawer.tsxfrontend/packages/console-plugin-sdk/src/api/usePluginInfo.tsfrontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsxfrontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsxfrontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx
🔇 Additional comments (24)
frontend/public/plugins.ts (1)
29-29: LGTM! PluginStore constructor updated to remove i18nNamespaces.The removal of the i18nNamespaces parameter aligns with the PR's objective to migrate i18n namespace handling to SERVER_FLAGS. This change is consistent with the broader refactoring across the codebase.
frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts (1)
28-50: LGTM! Test helpers updated with lowercase status strings.The test helper functions correctly use lowercase status values ('loaded', 'pending', 'failed') to align with the production code changes. This ensures test data matches the expected runtime behavior.
frontend/public/components/app-contents.tsx (1)
158-165: LGTM! Correctly adapted to updated usePluginInfo return type.The change from tuple destructuring to direct value assignment is correct, and the memoized computation of
allPluginsProcessedproperly replaces the previous tuple value. The dependency array correctly includespluginInfoEntries, and the logic accurately checks whether all plugins have completed processing (status !== 'pending').frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts (1)
120-133: LGTM! Status comparisons updated to lowercase.The status checks correctly use lowercase string literals ('loaded', 'failed') to match the normalized plugin status values. The dependency resolution logic remains unchanged and functions correctly with the updated status values.
frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx (1)
103-112: LGTM! Status checks updated to use lowercase strings.The replacement of
isLoadedDynamicPluginInfo(entry)withentry?.status === 'loaded'correctly removes dependency on the type guard predicate while maintaining the same logic. The optional chaining ensures safe property access, and the lowercase status comparison aligns with the normalized plugin status values.frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx (2)
7-19: LGTM! Correctly adapted to updated usePluginInfo return type.The changes properly update the hook usage to receive a direct value instead of a tuple, use lowercase status checks, and correctly expand the memoization dependency array to include both
pluginInfoEntriesandpluginName.
21-25: LGTM! Status comparison uses lowercase string.The error message extraction correctly uses the lowercase 'failed' status check, aligning with the normalized plugin status values.
frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts (1)
4-16: LGTM! Health state checks updated to lowercase status strings.The status string comparisons are correctly normalized to lowercase ('failed', 'pending', 'loaded') while maintaining the existing health state determination logic. The function correctly returns ERROR for any failed plugins, PROGRESS for any pending plugins, OK when all are loaded, and UNKNOWN otherwise.
frontend/public/i18n.js (1)
78-78: LGTM! i18n namespaces migrated to SERVER_FLAGS.The migration from
pluginStore.getI18nNamespaces()towindow.SERVER_FLAGS.i18nNamespacesaligns with the PR's objective to remove i18n namespace handling from PluginStore.Verification confirms that
window.SERVER_FLAGS.i18nNamespacesis always defined as an array: in the backend atcmd/bridge/main.golines 246-255,i18nNamespacesis initialized as[]string{}and remains at least an empty slice[]regardless of whether the flag is provided. This guarantees the frontend code atfrontend/public/i18n.js:78will safely executeArray.from(new Set(window.SERVER_FLAGS.i18nNamespaces))without runtime errors.frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx (1)
9-24: LGTM!The refactoring correctly replaces the type guard predicate with direct status string checks. The logic properly handles both loaded and non-loaded states by accessing the appropriate fields based on status.
frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts (2)
285-292: LGTM!Test expectations correctly updated to reflect lowercase status values ('pending').
585-590: LGTM!All test expectations consistently updated to use lowercase status literals ('loaded', 'pending', 'failed') throughout the test suite, aligning with the SDK changes.
Also applies to: 957-1024
frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx (1)
12-41: LGTM!The refactoring correctly removes the type guard predicate in favor of direct status checks. The logic properly handles the
developmentModeflag and safely accesses plugin fields using optional chaining.frontend/public/components/about-modal.tsx (1)
35-54: LGTM!The refactoring correctly replaces the type guard with a direct status check using optional chaining. The filter and sort logic properly handles loaded plugins.
frontend/public/components/notification-drawer.tsx (1)
246-246: LGTM!The hook usage correctly updated to direct value assignment.
frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx (1)
7-22: LGTM!The refactoring correctly replaces the type guard with direct status checks. The logic safely accesses plugin metadata using optional chaining and properly handles both loaded and non-loaded states.
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
25-58: LGTM!The API change from tuple to single value return is correctly implemented. The removal of
allPluginsProcessedtracking simplifies the hook while maintaining the subscription pattern. Documentation and example usage appropriately updated.frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (4)
93-93: LGTM: Status comparisons normalized to lowercase.The status comparisons correctly use lowercase 'failed' to align with the updated status literals from the plugin store.
Also applies to: 359-361
297-316: LGTM: DevPluginsPage updated for new usePluginInfo API.The component correctly adapts to the new
usePluginInfoAPI that returns a single value instead of a tuple. The filtering and mapping logic is clear and correct.
158-158: LGTM: ConsolePluginsTable props simplified.The removal of the
loadedprop aligns with the PR objective to removeallPluginsProcessedfrom the plugin info API.Also applies to: 434-436
2-2: Verify thatPluginInfoEntry['status']from the external SDK supports the required status literals.The import of
PluginInfoEntryfrom@openshift/dynamic-plugin-sdk@^5.0.1is syntactically correct and used at lines 422 and 439. However, the external SDK'sPluginInfoEntry['status']type definition cannot be verified in the codebase. Ensure the external SDK's type supports the status literals used here ('loaded','pending','failed'), which match the internalDynamicPluginInfotype defined infrontend/packages/console-plugin-sdk/src/store.ts:311-328.Also applies to: 422-422, 439-439
frontend/packages/console-plugin-sdk/src/store.ts (3)
70-82: LGTM: i18nNamespaces removed from PluginStore.The constructor signature correctly removes the
i18nNamespacesparameter, aligning with the PR objective to remove i18n namespace handling from PluginStore.
226-267: LGTM: Status literals normalized to lowercase.The
getPluginInfomethod correctly returns lowercase status values ('loaded', 'failed', 'pending'), ensuring consistency with the type definitions and consuming components.
311-329: LGTM: Type definitions align with runtime status values.The type definitions correctly use lowercase string literal types that match the runtime values returned by
getPluginInfo. This ensures type safety when checking plugin status.
3840f6e to
962bb0d
Compare
| const sortedRows = React.useMemo(() => rows.sort(compare), [rows, compare]); | ||
|
|
||
| return !loaded ? ( | ||
| <LoadingBox /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loaded prop value comes from usePluginInfo hook's second tuple element
const [pluginInfoEntries, allPluginsProcessed] = usePluginInfo();which is true once all Console plugins have finished loading, i.e. there are no plugins in "pending" state.
So currently <ConsolePluginsTable> renders a loading state until all plugins are done loading.
I think it makes more sense for <ConsolePluginsTable> to render plugin information regardless of the plugin state so 👍 on this change.
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx
Outdated
Show resolved
Hide resolved
...tend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx
Outdated
Show resolved
Hide resolved
frontend/public/i18n.js
Outdated
| 'vsphere-plugin', | ||
| 'webterminal-plugin', | ||
| ...pluginStore.getI18nNamespaces(), | ||
| ...Array.from(new Set(window.SERVER_FLAGS.i18nNamespaces)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on removing direct reference to pluginStore
| const i18nNamespaces = getI18nNamespaces(); | ||
|
|
||
| export const pluginStore = new PluginStore(activePlugins, dynamicPluginNames, i18nNamespaces); | ||
| export const pluginStore = new PluginStore(activePlugins, dynamicPluginNames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 pluginStore should not be concerned with i18n aspect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (1)
354-365: Fix null safety issue with optional chaining.Lines 359 and 361 access
notLoadedPluginInfo.statuswithout optional chaining, butnotLoadedPluginInfocan be undefined (it's the result of.find()on lines 341-343). This will cause a runtime error when a ConsolePlugin CR exists but hasn't been found in the plugin info array.Apply this diff to add optional chaining:
return { name: plugin?.metadata?.name, enabled, status: notLoadedPluginInfo?.status, errorMessage: - notLoadedPluginInfo.status === 'failed' ? notLoadedPluginInfo?.errorMessage : undefined, + notLoadedPluginInfo?.status === 'failed' ? notLoadedPluginInfo?.errorMessage : undefined, errorCause: - notLoadedPluginInfo.status === 'failed' + notLoadedPluginInfo?.status === 'failed' ? notLoadedPluginInfo?.errorCause?.toString() : undefined, };
♻️ Duplicate comments (2)
frontend/public/components/notification-drawer.tsx (1)
165-165: LGTM! Implementation matches past review suggestion.The filtering logic correctly uses lowercase
'failed'status and removes the dependency on type guard functions, aligning with the SDK's PluginInfoEntry.status convention.frontend/public/components/about-modal.tsx (1)
39-39: LGTM! Implementation matches past review suggestion.The filtering logic correctly uses lowercase
'loaded'status and removes the dependency on theisLoadedDynamicPluginInfotype guard, aligning with the SDK's PluginInfoEntry.status convention.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (11)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx(10 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx(1 hunks)frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx(1 hunks)frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts(3 hunks)frontend/public/components/about-modal.tsx(1 hunks)frontend/public/components/app-contents.tsx(1 hunks)frontend/public/components/notification-drawer.tsx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx
- frontend/public/components/app-contents.tsx
- frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx
- frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/public/components/notification-drawer.tsxfrontend/public/components/about-modal.tsxfrontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsxfrontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx
🔇 Additional comments (9)
frontend/public/components/notification-drawer.tsx (1)
246-246: LGTM! Correctly updated to match SDK API.The change from tuple destructuring to direct value assignment aligns with the SDK's
usePluginInforeturn type and is consistent with similar updates across the codebase.frontend/public/components/about-modal.tsx (1)
35-35: LGTM! Correctly updated to match SDK API.The direct value assignment from
usePluginInfo()correctly reflects the API change to return a single array value instead of a tuple.frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (7)
2-2: LGTM! SDK type import added.The import of
PluginInfoEntryfrom the SDK correctly supports the migration away from internal plugin types.Also applies to: 34-34
93-93: LGTM! Status comparison updated to lowercase.The change to lowercase
'failed'correctly aligns with the SDK's PluginInfoEntry status values.
158-158: LGTM! Removed loading state prop.The removal of the
loadedprop aligns with the decision to render plugin information regardless of loading state, improving UX as noted in previous review feedback.
222-293: LGTM! Simplified rendering without loading state.The table now renders immediately with available plugin data, providing better UX by showing information as soon as it's available rather than waiting for all plugins to load.
297-316: LGTM! Simplified plugin info usage.The changes correctly update to the new
usePluginInfoAPI that returns a single array, and replace type guards with direct status checks for better clarity.
338-343: LGTM! Replaced type guards with direct status checks.The filter logic using
p.status === 'loaded'andp.status !== 'loaded'is cleaner and more direct than using type guard functions.
422-422: LGTM! Types updated to use SDK types.The type changes from internal
DynamicPluginInfo['status']to SDKPluginInfoEntry['status']correctly align with the SDK migration goals.Also applies to: 439-439
frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx
Show resolved
Hide resolved
5f7964c to
6af823f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (1)
320-368: Protect againstnotLoadedPluginInfobeingundefinedand align status/error typingIn
PluginsPage,notLoadedPluginInfo(Lines 341-343) is derived via.find(...)and can beundefined(plugin info not present yet, static-only plugin, etc.). However, Lines 359 and 361 accessnotLoadedPluginInfo.statuswithout a null check, which will throw at runtime whennotLoadedPluginInfois missing. Additionally,statusinConsolePluginTableRowis non-optional, but you assignnotLoadedPluginInfo?.status, which can beundefined.You can fix both by introducing a local
statusvariable derived safely and reusing it for error fields:const notLoadedPluginInfo = pluginInfo .filter((p) => p.status !== 'loaded') .find((i) => i?.pluginName === pluginName); if (loadedPluginInfo) { return { name: plugin?.metadata?.name, version: loadedPluginInfo?.metadata?.version, description: loadedPluginInfo?.metadata?.customProperties?.console?.description, enabled, status: loadedPluginInfo?.status, hasCSPViolations: cspViolations[plugin.metadata.name] ?? false, }; } + const status = notLoadedPluginInfo?.status; return { name: plugin?.metadata?.name, enabled, - status: notLoadedPluginInfo?.status, - errorMessage: - notLoadedPluginInfo.status === 'failed' ? notLoadedPluginInfo?.errorMessage : undefined, - errorCause: - notLoadedPluginInfo.status === 'failed' - ? notLoadedPluginInfo?.errorCause?.toString() - : undefined, + status, + errorMessage: + status === 'failed' ? notLoadedPluginInfo?.errorMessage : undefined, + errorCause: + status === 'failed' ? notLoadedPluginInfo?.errorCause?.toString() : undefined, };This avoids crashing when
notLoadedPluginInfois absent and keeps status/error fields consistent with the status value.
♻️ Duplicate comments (3)
frontend/public/components/notification-drawer.tsx (1)
165-165: LGTM! Status filtering updated correctly.The inline status check using lowercase
'failed'correctly replaces the removed helper function and aligns with the SDK's status representation.frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx (1)
21-26: LGTM! Filtering logic correctly migrated to inline status checks.The inline status checks correctly replace the removed helper predicates:
- Line 21-23: Filters for
status !== 'loaded'(replacesisNotLoadedDynamicPluginInfo)- Lines 24-26: Correctly filter for specific states using lowercase status strings
The logic is sound and aligns with the PR objective to use lowercase status values and remove helper dependencies.
frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx (1)
7-21: Guard againstpluginInfobeingundefinedbefore accessingstatus/metadataOn Line 13,
pluginInfoEntries.find(...)can returnundefined(no matching entry yet, plugin missing, orpluginNameundefined), but Line 21 unconditionally readspluginInfo.statusandpluginInfo.metadata.version. This will throw at runtime and likely violatestrictNullChecks.Consider an early guard returning
DASHwhen the entry is missing or not loaded:const pluginInfo = React.useMemo( () => pluginInfoEntries.find((entry) => entry.status === 'loaded' ? entry.metadata.name === pluginName : entry.pluginName === pluginName, ), [pluginInfoEntries, pluginName], ); - return pluginInfo.status === 'loaded' ? <>{pluginInfo.metadata.version}</> : <>{DASH}</>; + if (!pluginInfo || pluginInfo.status !== 'loaded') { + return <>{DASH}</>; + } + + return <>{pluginInfo.metadata.version}</>;This preserves behavior while avoiding crashes when the plugin info is absent or still loading.
🧹 Nitpick comments (1)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (1)
158-294: Avoid mutatingrowsprop when computingsortedRows
sortedRowsis computed viarows.sort(compare)(Line 220), which sorts therowsarray in place. Even though current callers buildrowsfreshly, mutating props is brittle and can cause subtle bugs ifrowsis ever reused or shared.Consider sorting a shallow copy instead:
- const sortedRows = React.useMemo(() => rows.sort(compare), [rows, compare]); + const sortedRows = React.useMemo(() => [...rows].sort(compare), [rows, compare]);This keeps
ConsolePluginsTablepurely functional with respect to itsrowsprop.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (18)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx(10 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts(1 hunks)frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts(1 hunks)frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts(6 hunks)frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts(3 hunks)frontend/packages/console-plugin-sdk/src/store.ts(5 hunks)frontend/public/components/about-modal.tsx(1 hunks)frontend/public/components/app-contents.tsx(1 hunks)frontend/public/components/notification-drawer.tsx(3 hunks)frontend/public/i18n.js(1 hunks)frontend/public/plugins.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
- frontend/public/components/about-modal.tsx
- frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx
- frontend/public/i18n.js
- frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx
- frontend/packages/console-plugin-sdk/src/store.ts
- frontend/public/components/app-contents.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/packages/console-plugin-sdk/src/__tests__/store.spec.tsfrontend/public/plugins.tsfrontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsxfrontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.tsfrontend/packages/console-plugin-sdk/src/api/usePluginInfo.tsfrontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.tsfrontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsxfrontend/public/components/notification-drawer.tsxfrontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx
🔇 Additional comments (13)
frontend/public/plugins.ts (1)
29-29: LGTM! Simplified PluginStore initialization aligns with SDK.The removal of the
i18nNamespacesparameter improves separation of concerns by decoupling plugin store initialization from i18n management. This change aligns with the PR objective to match the SDK PluginStore signature.frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts (1)
28-50: LGTM! Status normalization aligns test data with runtime behavior.The lowercase status values ('loaded', 'pending', 'failed') in the test helpers now match the updated runtime checks in the dependency resolution logic.
frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts (1)
120-133: LGTM! Runtime status checks correctly updated to lowercase.The status comparisons now use lowercase 'loaded' and 'failed' strings, maintaining consistency with the test helpers and aligning with SDK PluginInfoEntry.status.
frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts (3)
268-293: LGTM! Status normalization is correctly applied.The test expectations correctly reflect the lowercase status values ('pending') for plugins in initial state. The constructor signature using two parameters aligns with the removal of
i18nNamespacesmentioned in the PR objectives.
583-591: LGTM! Loaded status correctly normalized.The test expectation correctly reflects the lowercase status value ('loaded') for successfully added dynamic plugins.
949-1025: LGTM! Complete status lifecycle correctly normalized.The test expectations correctly reflect all three lowercase status values ('pending', 'loaded', 'failed') throughout the plugin lifecycle. The comprehensive coverage validates proper status transitions from initial state through loading and failure scenarios.
frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts (1)
6-12: Changes are correct—plugin status values already use lowercase in SDK types.The PR changes align with the actual
DynamicPluginInfotype definitions. The SDK definesLoadedDynamicPluginInfowithstatus: 'loaded'andNotLoadedDynamicPluginInfowithstatus: 'pending'orstatus: 'failed'(all lowercase). The status comparisons in lines 6, 9, and 12 now correctly match the actual type values returned bypluginStore.getPluginInfo().frontend/public/components/notification-drawer.tsx (2)
17-17: LGTM! Import simplified to align with SDK.The removal of
isNotLoadedDynamicPluginInfoaligns with the PR objective to decrease dependence on helper predicates from@console/plugin-sdk.
246-246: LGTM! Updated to match new usePluginInfo API.The change from tuple destructuring to direct assignment correctly reflects the updated
usePluginInfo()return type, which now returnsDynamicPluginInfo[]instead of[DynamicPluginInfo[], boolean].frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
16-16: LGTM! API simplified to align with dynamic-plugin-sdk.The hook now returns
DynamicPluginInfo[]directly instead of a tuple with theallPluginsProcessedboolean. This change:
- Aligns with the SDK's
usePluginInfoimplementation- Fulfills the PR objective to remove
allPluginsProcessedfrom usePluginInfo- Is safe per previous review discussion confirming this hook is not exposed via the Console plugin API
Also applies to: 25-25, 58-58
frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx (1)
17-17: LGTM! Updated to use new usePluginInfo API.Correctly changed from tuple destructuring to direct value assignment, matching the updated hook signature.
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (2)
2-2: Status typing and import alignment withPluginInfoEntrylook consistentImporting
PluginInfoEntry(Line 2) and wiringConsolePluginStatus,ConsolePluginTableRow.status, andConsolePluginStatusProps.statustoPluginInfoEntry['status'](Lines 90-94, 422-441) matches the status-based approach ('loaded' | 'failed' | ...) and the normalization to lowercase. No issues here.Also applies to: 90-94, 422-441
297-317: Dev plugins pageusePluginInfousage and status filtering look correctUsing the updated
usePluginInfo()return value directly (Line 297) and filtering toplugin.status === 'loaded'before mapping to table rows (Lines 304-313) aligns with the new API and avoids touching pending/failed entries. The CSP violations lookup also correctly keys offplugin.metadata.name. No issues here.
|
/retest-required |
6af823f to
4304f21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (18)
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx(10 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts(1 hunks)frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts(1 hunks)frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts(6 hunks)frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts(3 hunks)frontend/packages/console-plugin-sdk/src/store.ts(5 hunks)frontend/public/components/about-modal.tsx(1 hunks)frontend/public/components/app-contents.tsx(1 hunks)frontend/public/components/notification-drawer.tsx(3 hunks)frontend/public/i18n.js(1 hunks)frontend/public/plugins.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
- frontend/public/components/about-modal.tsx
- frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx
- frontend/public/components/notification-drawer.tsx
- frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts
- frontend/public/components/app-contents.tsx
- frontend/public/plugins.ts
- frontend/packages/console-plugin-sdk/src/tests/store.spec.ts
- frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts
- frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx
- frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/runtime/tests/plugin-dependencies.spec.ts
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.tsfrontend/public/i18n.jsfrontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsxfrontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsxfrontend/packages/console-plugin-sdk/src/store.ts
🔇 Additional comments (11)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (2)
16-16: LGTM: API simplified to align with SDK.The return type change from tuple to array and the updated documentation example correctly reflect the SDK alignment. Based on learnings from past review comments, this change is safe since
usePluginInfois not exposed via the Console plugin API.Also applies to: 25-25
58-58: LGTM: Return statement matches new signature.The simplified return value correctly implements the new single-value return type, eliminating the
allPluginsProcessedtracking as intended.frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx (2)
17-17: LGTM: Hook usage correctly updated.The
usePluginInfo()call correctly reflects the new single-value return type, removing the tuple destructuring.
21-26: LGTM: Status filtering correctly implemented with lowercase strings.The inline status-based filtering correctly replaces the removed
isLoadedDynamicPluginInfoandisNotLoadedDynamicPluginInfohelper predicates. The lowercase status values ('loaded', 'failed', 'pending') align with the SDK as intended.frontend/packages/console-plugin-sdk/src/store.ts (1)
70-82: LGTM! SDK alignment changes are consistent.The removal of the
i18nNamespacesparameter from the constructor and the lowercase status literals throughout ('loaded','failed','pending') are breaking changes, but they correctly align with the SDK as stated in the PR objectives. The implementation is consistent across runtime values and type definitions.Also applies to: 226-267, 311-330
frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (6)
158-158: LGTM - improved rendering logic.Removing the
loadedprop and rendering unconditionally improves UX by displaying plugin information regardless of loading state. The EmptyBox fallback handles the no-data case appropriately.Also applies to: 222-293
296-317: LGTM - clean refactor for dev mode.The refactor correctly consumes
usePluginInfo()as an array and filters for loaded plugins, which is appropriate for development mode display.
358-363: LGTM - correct error handling.The conditional error detail assignment is correct—only plugins with
status === 'failed'should exposeerrorMessageanderrorCause.
418-426: LGTM - improved type safety.The type definitions now correctly reference
PluginInfoEntry['status']from the SDK, improving type safety and alignment with the external API.Also applies to: 438-441
338-343: Property access pattern verified as correct.The code correctly accesses
metadata.namefor loaded plugins andpluginNamefor not-loaded plugins. This pattern is consistently used across multiple detail components (ConsolePluginVersionDetail, ConsolePluginStatusDetail, ConsolePluginEnabledStatusDetail, ConsolePluginDescriptionDetail) and aligns with the PluginInfoEntry type from @openshift/dynamic-plugin-sdk, which returns different object shapes based on plugin status.
2-2: Verify lowercase status values are supported by @openshift/dynamic-plugin-sdk v5.0.1.The code consistently uses lowercase status values (
'failed','loaded','pending'), but the SDK type definitions could not be definitively verified through web search. Before merging, please confirm thatPluginInfoEntry['status']in @openshift/dynamic-plugin-sdk v5.0.1 supports these lowercase literals by checking the package's TypeScript definitions (typically in the npm package or GitHub repository at https://github.com/openshift/dynamic-plugin-sdk).
84d7348 to
a53ba4e
Compare
|
Local build and testing shows there are no issues /verified by @logonoff |
|
@logonoff: This PR has been marked as verified by In response to this:
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 |
because we know it will never be null
The type is only used in the context of `AsyncComponent`, so it's better to move the type closer to where it is used
dceb2d2 to
4babc26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (6)
frontend/public/components/utils/async.tsx (3)
9-10: Fix the null comparison bug in sameLoader.The fallback strings
'a'and'b'causesameLoader(null)(null)to returnfalseinstead oftrue. When both loaders are null, the first part passes (undefined === undefined), but the second part evaluates to'a' === 'b', which fails.Apply this diff to fix the null-handling logic:
const sameLoader = (a: LazyLoader | null) => (b: LazyLoader | null) => - a?.name === b?.name && (a || 'a').toString() === (b || 'b').toString(); + a?.name === b?.name && a?.toString() === b?.toString();This ensures that
null === nullreturnstrueas expected.
86-89: Fix LoadingComponent type mismatch.Line 88 types
LoadingComponentasReactNode, but Line 77 renders it as<LoadingComponent />, which requires aComponentType. Typing it asReactNodeallows invalid values (strings, numbers, etc.) that will cause runtime errors.Apply this diff to fix the type:
export type AsyncComponentProps = { loader: LazyLoader; - LoadingComponent?: ReactNode; + LoadingComponent?: ComponentType; } & any;
90-93: Add nullability to AsyncComponentState types.Lines 91-92 declare
Componentandloaderas non-null, but Line 17 initializes them asnull, and Line 26 explicitly setsComponenttonull. This type mismatch will cause issues whenstrictNullChecksis enabled.Apply this diff to align types with runtime behavior:
export type AsyncComponentState = { - Component: ComponentType; - loader: LazyLoader; + Component: ComponentType | null; + loader: LazyLoader | null; };This matches the intent expressed in previous discussion to prepare for future
strictNullChecksenablement.frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx (1)
102-113: Plugin status checks correctly updated to lowercase'loaded'.The inline
entry.status === 'loaded'predicate andpluginIsLoadedcomputation match the new plugin status convention and preserve the previous branching onmetadata.namevspluginName.frontend/public/components/about-modal.tsx (1)
33-55: Dynamic plugins list correctly filters on'loaded'status.Using the direct
pluginInfoEntriesarray fromusePluginInfo()and filtering withplugin.status === 'loaded'is consistent with the new hook contract and avoids the removed helper while preserving behavior.frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx (1)
8-25: Console plugin status lookup updated to newusePluginInfo+ status semantics.Using the direct
pluginInfoEntriesarray and theentry.status === 'loaded'predicate maintains the old matching behavior while aligning with the lowercase statuses; passingerrorMessageonly for'failed'is also appropriate.
🧹 Nitpick comments (3)
frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md (1)
17-18: Minor: Consider consistent capitalization for "Type breaking" label.The entries use lowercase "breaking" (
Type breaking), whereas a past suggestion indicated uppercase "Breaking" (Type Breaking) for consistency with similar entries. Consider aligning the capitalization style across all type-related breaking changes, or verify this is the established convention for this changelog.frontend/packages/console-dynamic-plugin-sdk/src/coderefs/coderef-resolver.ts (1)
3-3: ExtensionDeclaration + AnyObject constraints in resolver are coherentThe shift to
ExtensionDeclaration[]inresolveEncodedCodeRefsand the updated generics inresolveExtension(usingExtensionDeclaration<string, P>andP extends AnyObject = ExtensionProperties<E>) keep the resolver aligned with the new public types and ensureMapCodeRefsToValues/UpdateExtensionPropertiesare only applied to object-likeproperties. The runtime behavior is unchanged and the additional constraints improve type safety without introducing regressions.If you ever want stronger preservation of concrete extension types through
resolveEncodedCodeRefs, you could genericize it as<E extends ExtensionDeclaration>(extensions: E[], …) => E[], but this is optional and not required for correctness.Also applies to: 5-13, 97-103, 117-121, 148-148
frontend/public/reducers/features.ts (1)
75-80: Known incorrect model ref +anycast should be tracked for follow‑upThe new
(…filter(isModelFeatureFlag) as any)plus the inline comment aboutreferenceForModelvsreferenceForExtensionModelmakes this a consciously papered‑over bug: Extension‑backed models will still compute an incorrect ref, and we’re now also bypassing type safety around these entries.Given the earlier decision not to change runtime behavior here, this is acceptable short‑term, but please ensure there’s a concrete follow‑up (Jira/TODO with an ID) to:
- Swap to the correct helper for extension models, and
- Remove the
as anyby using the proper typedgetExtensions<…>()once on@openshift/dynamic-plugin-sdk.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (95)
frontend/packages/console-app/src/__tests__/plugin-test-utils.ts(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx(10 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx(2 hunks)frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/NotLoadedDynamicPlugins.tsx(1 hunks)frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts(1 hunks)frontend/packages/console-app/src/components/detect-perspective/__tests__/PerspectiveDetector.spec.tsx(1 hunks)frontend/packages/console-app/src/components/nav/useNavExtensionForPerspective.ts(1 hunks)frontend/packages/console-app/src/components/user-preferences/perspective/PreferredPerspectiveSelect.tsx(1 hunks)frontend/packages/console-app/src/components/user-preferences/perspective/__tests__/perspective.data.ts(1 hunks)frontend/packages/console-app/src/hooks/useCSPViolationDetector.tsx(1 hunks)frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md(3 hunks)frontend/packages/console-dynamic-plugin-sdk/README.md(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/api/useResolvedExtensions.ts(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/coderefs/__tests__/coderef-resolver.spec.ts(8 hunks)frontend/packages/console-dynamic-plugin-sdk/src/coderefs/coderef-resolver.ts(3 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/actions.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/add-actions.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/alerts.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/breadcrumbs.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-configuration.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-overview.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-settings.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts(3 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/context-providers.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/create-project-modal.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/create-resource.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/dashboard-data-source.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/dashboards.ts(3 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/details-item.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/feature-flags.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/file-upload.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/guided-tour.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/horizontal-nav-tabs.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/import-environments.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/navigation.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/node.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/notification-alert.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/pages.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/perspectives.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/project-overview.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/pvc.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/redux.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/resource-metadata.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/storage-class-provisioner.ts(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/storage-provider.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/telemetry.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/topology-details.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/topology.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/user-preferences.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/extensions/yaml-templates.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-dependencies.spec.ts(2 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/__tests__/plugin-loader.spec.ts(3 hunks)frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/types.ts(4 hunks)frontend/packages/console-dynamic-plugin-sdk/src/utils/test-utils.ts(1 hunks)frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts(3 hunks)frontend/packages/console-dynamic-plugin-sdk/src/validation/__tests__/ExtensionValidator.spec.ts(3 hunks)frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts(13 hunks)frontend/packages/console-plugin-sdk/src/api/pluginSubscriptionService.ts(6 hunks)frontend/packages/console-plugin-sdk/src/api/useExtensions.ts(2 hunks)frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts(3 hunks)frontend/packages/console-plugin-sdk/src/codegen/__tests__/active-plugins.spec.ts(6 hunks)frontend/packages/console-plugin-sdk/src/codegen/active-plugins.ts(2 hunks)frontend/packages/console-plugin-sdk/src/index.ts(0 hunks)frontend/packages/console-plugin-sdk/src/store.ts(8 hunks)frontend/packages/console-plugin-sdk/src/typings/base.ts(1 hunks)frontend/packages/console-plugin-sdk/src/typings/index.ts(0 hunks)frontend/packages/console-plugin-sdk/src/utils/__tests__/extension-i18n.spec.ts(3 hunks)frontend/packages/console-plugin-sdk/src/utils/extension-i18n.ts(3 hunks)frontend/packages/console-plugin-sdk/src/utils/useTranslatedExtensions.ts(2 hunks)frontend/packages/console-shared/src/components/actions/__tests__/utils-test-data.ts(1 hunks)frontend/packages/console-shared/src/components/actions/utils.ts(1 hunks)frontend/packages/console-shared/src/components/dashboard/status-card/OperatorStatusBody.tsx(1 hunks)frontend/packages/console-shared/src/hooks/create-resource-hook.ts(1 hunks)frontend/packages/console-shared/src/hooks/perspective-utils.ts(1 hunks)frontend/packages/console-shared/src/utils/sample-utils.ts(1 hunks)frontend/packages/dev-console/src/components/add/AddCardSection.tsx(1 hunks)frontend/packages/dev-console/src/components/add/__tests__/add-page-test-data.tsx(1 hunks)frontend/packages/dev-console/src/components/import/import-types.ts(1 hunks)frontend/packages/integration-tests-cypress/tests/app/demo-dynamic-plugin.cy.ts(1 hunks)frontend/packages/topology/src/components/workload/utils.ts(2 hunks)frontend/public/components/about-modal.tsx(1 hunks)frontend/public/components/app-contents.tsx(1 hunks)frontend/public/components/dashboard/dashboards-page/cluster-dashboard/health-item.tsx(1 hunks)frontend/public/components/notification-drawer.tsx(3 hunks)frontend/public/components/utils/async.tsx(2 hunks)frontend/public/i18n.js(1 hunks)frontend/public/module/k8s/__tests__/get-resources.spec.ts(1 hunks)frontend/public/plugins.ts(2 hunks)frontend/public/reducers/features.ts(1 hunks)
💤 Files with no reviewable changes (2)
- frontend/packages/console-plugin-sdk/src/typings/index.ts
- frontend/packages/console-plugin-sdk/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (58)
- frontend/packages/console-app/src/components/detect-perspective/tests/PerspectiveDetector.spec.tsx
- frontend/public/components/dashboard/dashboards-page/cluster-dashboard/health-item.tsx
- frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/DynamicPluginsPopover.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/runtime/tests/plugin-dependencies.spec.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/add-actions.ts
- frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/NotLoadedDynamicPlugins.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/validation/tests/ExtensionValidator.spec.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/node.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/pages.ts
- frontend/packages/console-shared/src/utils/sample-utils.ts
- frontend/packages/dev-console/src/components/add/tests/add-page-test-data.tsx
- frontend/packages/integration-tests-cypress/tests/app/demo-dynamic-plugin.cy.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/import-environments.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/storage-class-provisioner.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/pvc.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/project-overview.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-settings.ts
- frontend/public/plugins.ts
- frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx
- frontend/packages/console-plugin-sdk/src/utils/tests/extension-i18n.spec.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/dashboard-data-source.ts
- frontend/packages/console-dynamic-plugin-sdk/src/runtime/tests/plugin-loader.spec.ts
- frontend/packages/console-dynamic-plugin-sdk/src/validation/ExtensionValidator.ts
- frontend/packages/console-plugin-sdk/src/codegen/tests/active-plugins.spec.ts
- frontend/packages/console-dynamic-plugin-sdk/src/utils/test-utils.ts
- frontend/public/components/app-contents.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/create-resource.ts
- frontend/packages/console-app/src/components/nav/useNavExtensionForPerspective.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/feature-flags.ts
- frontend/packages/console-dynamic-plugin-sdk/src/api/useResolvedExtensions.ts
- frontend/packages/console-app/src/components/console-operator/ConsolePluginVersionDetail.tsx
- frontend/packages/console-app/src/components/dashboards-page/dynamic-plugins-health-resource/status.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/navigation.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/file-upload.ts
- frontend/packages/console-shared/src/components/actions/tests/utils-test-data.ts
- frontend/packages/console-plugin-sdk/src/api/useExtensions.ts
- frontend/packages/console-app/src/tests/plugin-test-utils.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/topology-details.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/actions.ts
- frontend/packages/dev-console/src/components/add/AddCardSection.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-overview.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/horizontal-nav-tabs.ts
- frontend/packages/console-plugin-sdk/src/api/pluginSubscriptionService.ts
- frontend/packages/console-app/src/components/user-preferences/perspective/PreferredPerspectiveSelect.tsx
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/context-providers.ts
- frontend/packages/dev-console/src/components/import/import-types.ts
- frontend/packages/console-shared/src/components/actions/utils.ts
- frontend/packages/console-plugin-sdk/src/store.ts
- frontend/packages/console-plugin-sdk/src/typings/base.ts
- frontend/packages/topology/src/components/workload/utils.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/resource-metadata.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/redux.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/yaml-templates.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/storage-provider.ts
- frontend/packages/console-shared/src/hooks/perspective-utils.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/perspectives.ts
- frontend/packages/console-dynamic-plugin-sdk/src/extensions/guided-tour.ts
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-configuration.tsfrontend/public/i18n.jsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/notification-alert.tsfrontend/packages/console-dynamic-plugin-sdk/src/coderefs/coderef-resolver.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/topology.tsfrontend/packages/console-plugin-sdk/src/api/usePluginInfo.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.tsfrontend/packages/console-dynamic-plugin-sdk/src/coderefs/__tests__/coderef-resolver.spec.tsfrontend/public/reducers/features.tsfrontend/packages/console-app/src/components/user-preferences/perspective/__tests__/perspective.data.tsfrontend/public/components/about-modal.tsxfrontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.tsfrontend/public/components/utils/async.tsxfrontend/packages/console-dynamic-plugin-sdk/src/extensions/user-preferences.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/alerts.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/details-item.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/telemetry.tsfrontend/public/module/k8s/__tests__/get-resources.spec.tsfrontend/packages/console-app/src/hooks/useCSPViolationDetector.tsxfrontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsxfrontend/packages/console-dynamic-plugin-sdk/src/types.tsfrontend/packages/console-plugin-sdk/src/utils/useTranslatedExtensions.tsfrontend/public/components/notification-drawer.tsxfrontend/packages/console-dynamic-plugin-sdk/README.mdfrontend/packages/console-plugin-sdk/src/utils/extension-i18n.tsfrontend/packages/console-dynamic-plugin-sdk/src/extensions/dashboards.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsxfrontend/packages/console-shared/src/components/dashboard/status-card/OperatorStatusBody.tsxfrontend/packages/console-dynamic-plugin-sdk/src/extensions/breadcrumbs.tsfrontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsxfrontend/packages/console-shared/src/hooks/create-resource-hook.tsfrontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.mdfrontend/packages/console-dynamic-plugin-sdk/src/extensions/create-project-modal.tsfrontend/packages/console-plugin-sdk/src/__tests__/store.spec.tsfrontend/packages/console-plugin-sdk/src/codegen/active-plugins.ts
🧬 Code graph analysis (11)
frontend/packages/console-dynamic-plugin-sdk/src/coderefs/coderef-resolver.ts (1)
frontend/packages/console-dynamic-plugin-sdk/src/types.ts (1)
ExtensionProperties(67-67)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
frontend/packages/console-plugin-sdk/src/store.ts (1)
DynamicPluginInfo(331-331)
frontend/packages/console-dynamic-plugin-sdk/src/coderefs/__tests__/coderef-resolver.spec.ts (1)
frontend/packages/console-dynamic-plugin-sdk/src/types.ts (1)
CodeRef(57-57)
frontend/public/reducers/features.ts (2)
frontend/public/plugins.ts (1)
pluginStore(29-29)frontend/packages/console-dynamic-plugin-sdk/src/extensions/feature-flags.ts (1)
isModelFeatureFlag(38-39)
frontend/packages/console-app/src/components/console-operator/ConsolePluginStatusDetail.tsx (1)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
usePluginInfo(25-59)
frontend/public/components/notification-drawer.tsx (1)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
usePluginInfo(25-59)
frontend/packages/console-plugin-sdk/src/utils/extension-i18n.ts (1)
frontend/__mocks__/i18next.ts (1)
t(8-14)
frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx (1)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
usePluginInfo(25-59)
frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx (2)
frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
usePluginInfo(25-59)frontend/packages/console-app/src/components/console-operator/ConsoleOperatorConfig.tsx (3)
useConsoleOperatorConfigData(66-88)ConsolePluginEnabledStatus(95-134)developmentMode(59-59)
frontend/packages/console-shared/src/hooks/create-resource-hook.ts (3)
frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts (1)
GroupVersionKind(91-91)frontend/packages/console-dynamic-plugin-sdk/src/types.ts (1)
LoadedExtension(40-44)frontend/packages/console-dynamic-plugin-sdk/src/extensions/create-resource.ts (1)
CreateResource(9-17)
frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts (1)
frontend/packages/console-plugin-sdk/src/store.ts (1)
augmentExtension(15-25)
🔇 Additional comments (35)
frontend/packages/console-dynamic-plugin-sdk/README.md (3)
116-118: Version compatibility table consolidation looks good.The update to consolidate Console versions 4.19.x through 4.21.x under a single PatternFly 6.x entry aligns with the SDK consolidation mentioned in the PR objectives and accurately reflects the current support matrix.
206-212: Documentation updates for Console 4.20.x CSS styling changes are clear.The addition of styling removal notes (Bootstrap Grid, co-external-link, co-disabled) provides helpful migration guidance for plugin developers. The formatting with the blank line improves readability of the CSP warning section above it.
124-124: Path update verified — documentation is accurate.The shared modules reference path has been confirmed as correct. The file
./src/shared-modules/shared-modules-meta.tsexists at the documented location and the README change is accurate.frontend/packages/console-dynamic-plugin-sdk/CHANGELOG-core.md (1)
15-26: Reference citations and formatting look solid.All new changelog entries properly cite their associated references, and the newly added reference links (CONSOLE-4701, #15735) are correctly ordered. The past review comments regarding the #15738 reference have been resolved.
frontend/packages/console-dynamic-plugin-sdk/src/extensions/user-preferences.ts (1)
3-3: LGTM! Clean migration to ExtensionDeclaration.The changes consistently migrate from
ExtensiontoExtensionDeclarationacross imports and type guards. The type guard logic remains unchanged, only refining the input type, which aligns with the repository-wide SDK consolidation effort described in the PR objectives.Also applies to: 85-91
frontend/public/i18n.js (1)
78-78: LGTM: Defensive check in place.The
?? []correctly handles null/undefined cases forwindow.SERVER_FLAGS.i18nNamespaces, and thenew Set()deduplicates any overlapping namespaces.frontend/packages/console-app/src/components/user-preferences/perspective/__tests__/perspective.data.ts (1)
3-3: Let me verify whether these types are available from the package root or if importing from/src/typesis the only option:Let me check the actual structure of the @console/dynamic-plugin-sdk package to understand the intended exports:
Let me search for information about this specific refactoring to understand if this is the intended migration pattern:
Imports from
/src/typesare consistent across the codebase and appear intentional.The verification shows 41 files across
frontend/publicandfrontend/packagesimport from@console/dynamic-plugin-sdk/src/types, including production code (not just tests). This widespread pattern aligns with the PR's goal of removing barrel files from@console/plugin-sdk.While importing from
/src/typesdoes couple consumers to the package's internal structure, this appears to be an intentional architectural decision for this refactor. The pattern is established and consistent; the test file change is not anomalous.Note: If
LoadedExtensionshould be part of the public API, consider adding it to the package root exports to provide a stable import path.frontend/public/components/utils/async.tsx (3)
1-1: LGTM!Import changes correctly bring in the necessary types for the refactored AsyncComponent implementation.
16-16: LGTM!Using the imported
ClassComponentalias maintains consistency with the updated import structure.
81-84: LGTM!The
LazyLoadertype alias improves code clarity and provides a reusable interface for async component loading across the codebase.frontend/packages/console-shared/src/components/dashboard/status-card/OperatorStatusBody.tsx (1)
6-6: Type-onlyLazyLoaderimport looks correctUsing
import typefrom@console/internal/components/utils/asynckeeps the existing prop surface while dropping the runtime dependency on@console/plugin-sdk, which matches the PR’s migration goals. No further changes needed here.frontend/packages/console-dynamic-plugin-sdk/src/extensions/breadcrumbs.ts (1)
2-2: LGTM!The import and type guard updates align with the migration to
ExtensionDeclarationas the canonical extension type. The type guard correctly narrows fromExtensionDeclarationtoDetailPageBreadCrumbs.Also applies to: 25-26
frontend/packages/console-dynamic-plugin-sdk/src/coderefs/__tests__/coderef-resolver.spec.ts (2)
209-210: LGTM!Good use of local type aliases
FooExtensionandBarExtensionto make test expectations explicit and improve type safety when casting resolved extensions.
253-256: LGTM!Test data arrays correctly typed as
ExtensionDeclaration[], consistent with the migration to the canonical extension type.Also applies to: 280-295, 315-330, 349-358, 367-370
frontend/packages/console-dynamic-plugin-sdk/src/extensions/cluster-configuration.ts (1)
117-127: LGTM!Type guards updated consistently to accept
ExtensionDeclarationas the input type, with correct narrowing toClusterConfigurationGroupandClusterConfigurationItem.frontend/packages/console-plugin-sdk/src/utils/extension-i18n.ts (1)
2-2: LGTM!This change addresses the past review comment by consistently replacing
ExtensionwithExtensionDeclaration. The import now sources from@console/dynamic-plugin-sdk/src/typesinstead of local typings, aligning with the SDK consolidation.Also applies to: 18-18, 30-33
frontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.ts (1)
112-140: LGTM!All six catalog type guards updated consistently to accept
ExtensionDeclaration, maintaining proper narrowing to their respective specific types. The changes are purely type-level with no behavioral impact.frontend/packages/console-dynamic-plugin-sdk/src/types.ts (1)
3-8: ExtensionDeclaration-centric generics look consistent and safeThe new aliasing and generic constraints around
LoadedExtension,ExtensionProperties,UpdateExtensionProperties, andResolvedExtensionare consistent with the SDK’sExtensionshape and tighten property typing viaAnyObjectwithout changing runtime behavior. No issues from a type-safety or compatibility perspective stand out here.Also applies to: 40-43, 67-76, 88-91
frontend/public/module/k8s/__tests__/get-resources.spec.ts (1)
2-2: Type import switch to dynamic-plugin-sdk is fineSwitching
LoadedExtensionto come from@console/dynamic-plugin-sdk/src/typeskeeps the test’s typing consistent with the new SDK source of truth and doesn’t affect runtime behavior.Also applies to: 61-63
frontend/packages/console-dynamic-plugin-sdk/src/extensions/create-project-modal.ts (1)
2-2: Guard alignment with ExtensionDeclaration is correctUpdating
isCreateProjectModalto acceptExtensionDeclarationkeeps the guard consistent with the declaredCreateProjectModaltype while preserving the same runtime discriminant check.Also applies to: 10-16, 18-19
frontend/packages/console-dynamic-plugin-sdk/src/extensions/details-item.ts (1)
2-2: DetailsItem guards correctly migrated to ExtensionDeclaration
DetailsItemandisDetailsItemnow consistently useExtensionDeclaration, and the left/right helpers still narrow safely based onproperties.column. This keeps the public shape and runtime logic intact.Also applies to: 19-63, 65-72
frontend/packages/console-shared/src/hooks/create-resource-hook.ts (1)
3-3: useCreateResourceExtension remains type-safe after guard updateUsing
ExtensionDeclarationin the local type guard aligns withisCreateResourceand theCreateResourcedeclaration while preserving the existing behavior ofuseCreateResourceExtensionreturning aLoadedExtension<CreateResource>.Also applies to: 7-16
frontend/packages/console-dynamic-plugin-sdk/src/extensions/notification-alert.ts (1)
3-3: AlertAction guard uses the new canonical ExtensionDeclaration typeSwitching
isAlertActionto acceptExtensionDeclarationmatches the declaredAlertActionshape and keeps the runtime check unchanged.Also applies to: 6-16, 18-19
frontend/packages/console-dynamic-plugin-sdk/src/extensions/alerts.ts (1)
2-2: Alert extension guards correctly updated to ExtensionDeclarationBoth
isAlertingRulesSourceandisAlertingRuleChartnow operate onExtensionDeclarationwhile keeping theirtypechecks identical, so behavior is preserved and the typings match the declared extension types.Also applies to: 7-17, 22-30, 34-38
frontend/packages/console-dynamic-plugin-sdk/src/extensions/telemetry.ts (1)
1-21: Telemetry extension guard correctly aligned withExtensionDeclaration.Import and
isTelemetryListenernow consistently useExtensionDeclarationwhile preserving the existing runtime check ontype. No functional or typing issues here.frontend/packages/console-dynamic-plugin-sdk/src/extensions/topology.ts (1)
2-119: Topology extension guards cleanly migrated toExtensionDeclaration.All topology
is*guards now takeExtensionDeclarationand still narrow correctly based on thetypeliteral. This keeps the public surface consistent with the rest of the SDK without changing runtime behavior.frontend/packages/console-dynamic-plugin-sdk/src/extensions/dashboards.ts (1)
3-3: Dashboards guards consistently refactored toExtensionDeclaration/ResolvedExtension.The dashboards extension and resolved-extension guards are now typed around
ExtensionDeclarationwhile retaining the sametype-based discrimination. This matches the new SDK type surface and should integrate cleanly with callers usinguseResolvedExtensionsandusePluginInfo.Also applies to: 221-307
frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-dependencies.ts (1)
120-133: Dependency resolution now matches normalized plugin status values.Using
e.status === 'loaded'forloadedPluginsande.status === 'failed'forfailedPluginNameskeeps dependency resolution behavior intact while aligning with the new lowercase status strings.frontend/packages/console-plugin-sdk/src/utils/useTranslatedExtensions.ts (1)
2-16:useTranslatedExtensionsgeneric correctly constrained toExtensionDeclaration.Switching to
ExtensionDeclaration/LoadedExtensionkeeps this hook aligned with the new extension type hierarchy while leaving the translation logic untouched.frontend/packages/console-plugin-sdk/src/api/usePluginInfo.ts (1)
16-58: usePluginInfo hook refactor looks soundThe hook’s simplification to return just
DynamicPluginInfo[]keeps the existing subscription/cleanup behavior intact and aligns with the dynamic‑plugin‑sdk API. No new lifecycle or leak issues are apparent, and callers depending on the old tuple are being updated elsewhere in this PR.frontend/public/components/notification-drawer.tsx (1)
17-18: Dynamic plugin failure handling matches new plugin info APIUsing
usePluginInfo()as a directDynamicPluginInfo[]source and filtering failures viaplugin.status === 'failed'is consistent with the updated store typings and test expectations; the notification rendering logic remains unchanged.Also applies to: 165-235, 246-279
frontend/packages/console-plugin-sdk/src/codegen/active-plugins.ts (1)
10-16: Active plugin test helper typing aligns with new ExtensionDeclaration modelSwitching the extension hook to
ExtensionDeclaration[]and importingActivePluginfrom the base typings matches how the store models extensions now. This is a clean, type‑only adjustment with no runtime impact.Also applies to: 79-88
frontend/packages/console-app/src/components/console-operator/ConsolePluginDescriptionDetail.tsx (1)
9-24: Loaded‑only description logic is correct and type‑safeUsing
usePluginInfo()directly and matching bymetadata.nameonly whenstatus === 'loaded'avoids touchingmetadataon non‑loaded entries, and the finalpluginInfo?.status === 'loaded'guard ensures we only render a description for successfully loaded plugins.frontend/packages/console-plugin-sdk/src/__tests__/store.spec.ts (1)
3-212: Test updates correctly reflect ExtensionDeclaration typing and lowercase statusesMigrating test fixtures to
ExtensionDeclarationand updating allgetPluginInfoexpectations to the new lowercase status literals ('pending' | 'loaded' | 'failed') keeps these specs aligned with the store’s actual types and behavior. The scenarios around gating, dynamic extension enabling/disabling, and plugin failure still appear well covered.Also applies to: 285-292, 330-341, 531-541, 585-591, 957-1024
frontend/packages/console-app/src/components/console-operator/ConsolePluginEnabledStatusDetail.tsx (1)
12-37: Enabled-status derivation matches new plugin info modelUsing
usePluginInfo()directly, matching entries bymetadata.nameonly for'loaded'statuses, and then gating the dev‑modeenabledflag viapluginInfo?.status === 'loaded' && pluginInfo.enabledgives correct behavior for loaded vs pending/failed plugins while keeping the production path tied toconsoleOperatorConfig. The addedconsoleOperatorConfigLoaded && pluginNameguard is also a sensible safety check.
|
/test images |
|
/verified by @logonoff changes since last verification are type-only and do not affect runtime:
in addition I tested my changes against monitoring-plugin and everything continues to work the same as it did
|
|
@logonoff: This PR has been marked as verified by In response to this:
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 |
|
reverted last 4 commits /verified by @logonoff |
|
@logonoff: This PR has been marked as verified by In response to this:
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. |
|
/lgtm |
|
/label plugin-api-approved |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@logonoff: This pull request references CONSOLE-3769 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 either version "4.21." or "openshift-4.21.", but it targets "openshift-4.15" instead. In response to this:
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 |
|
@logonoff: all tests passed! Full PR test history. Your PR dashboard. 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. |


DynamicPluginInfo.statuschanged to lowercase to align with SDKPluginInfoEntry.statusallPluginsProcessedremoved fromusePluginInfoto align with SDKusePluginInfoPluginStoreisLoadedDynamicPluginInfoandisNotLoadedDynamicPluginInforemoved to decrease dependence on@console/plugin-sdkExtensionDeclarationrenamed toExtension, because there are no more "static extensions".ExtensionDeclarationtype is removed and its replacement is theExtensiontype.The idea of "dynamic" vs "static" extensions are entirely removed, we only have "extensions".@console/plugin-sdkbarrel files and type reexports are removedLazyLoadertype in@console/plugin-sdkmigrated toAsyncComponentbecause it's only used in that context