Skip to content

MGMT-20483: Use categories for operators#2998

Merged
openshift-merge-bot[bot] merged 6 commits intoopenshift-assisted:masterfrom
ammont82:MGMT-20481-operators-improvements-new
Jun 19, 2025
Merged

MGMT-20483: Use categories for operators#2998
openshift-merge-bot[bot] merged 6 commits intoopenshift-assisted:masterfrom
ammont82:MGMT-20481-operators-improvements-new

Conversation

@ammont82
Copy link
Member

@ammont82 ammont82 commented Jun 18, 2025

Related with: https://issues.redhat.com/browse/MGMT-20483

Use these categories for operators:
image

image

Summary by CodeRabbit

  • New Features

    • Operator descriptions are now centrally managed and available for use in the UI.
    • Operators are organized into categories (e.g., Storage, Virtualization, AI) for improved browsing and selection.
    • Operator metadata now includes support level and category information.
  • Refactor

    • Operator specification access is streamlined across multiple components, improving consistency and maintainability.
    • Operator title retrieval is simplified via a new utility function.
    • Operator selection UI now displays operators grouped by category.
  • Chores

    • Updated function and type signatures to support the new operator categorization and metadata.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 18, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jun 18, 2025

@ammont82: This pull request references MGMT-20483 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 sub-task to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Related with: https://issues.redhat.com/browse/MGMT-20483

Use these categories for operators:
image

image

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from celdrake and rawagner June 18, 2025 06:01
@coderabbitai
Copy link

coderabbitai bot commented Jun 18, 2025

Walkthrough

The changes restructure operator specifications by introducing categorized grouping, centralized description constants, and enhanced metadata such as support levels. The useOperatorSpecs hook now returns both categorized and key-based operator spec maps. Multiple components are updated to use only the key-based map, and operator title retrieval is streamlined via a new utility function.

Changes

Files/Paths (grouped) Change Summary
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx
.../operatorDescriptions.tsx
Operator specs reorganized into categories; centralized descriptions added; new metadata fields (supportLevel, category); new utility for title lookup; new description constants exported.
libs/ui-lib/lib/common/components/clusterDetail/OperatorsProgressItem.tsx
.../OcmOperatorProgressItem.tsx
.../OperatorCheckbox.tsx
.../ReviewOperatorsTable.tsx
.../ProgressBarAlerts.tsx
Updated to use only the byKey property from useOperatorSpecs for operator spec access.
libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx Refactored to use the key-based operator spec map for support level checks; simplified function signatures and lookups.
libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx Refactored to render operators by category; uses both categorized and key-based operator spec maps; simplifies filtering and rendering logic.
libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts Operator title lookups now use the new getOperatorTitleByFeatureId utility, removing direct constant and spec map access.
libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts Added optional title parameter to GetFeatureDisabledReason function type.

Sequence Diagram(s)

sequenceDiagram
    participant UI_Component
    participant useOperatorSpecs
    participant operatorSpecs
    participant operatorDescriptions

    UI_Component->>useOperatorSpecs: Call useOperatorSpecs()
    useOperatorSpecs->>operatorSpecs: getOperatorSpecs(getFeatureSupportLevel, useLVMS)
    operatorSpecs->>operatorDescriptions: Fetch descriptionText constants
    operatorSpecs-->>useOperatorSpecs: Return { byCategory, byKey }
    useOperatorSpecs-->>UI_Component: Return { byCategory, byKey }
    UI_Component->>byKey: Access operator spec by key
    UI_Component->>byCategory: Iterate operators by category
Loading

Possibly related PRs

  • #2944: Updates the Kube Descheduler operator spec, overlapping with this PR's restructuring of operator specs.
  • #2927: Refactors getBundleSupportLevel to use the operator spec's supportLevel, directly related to changes in this PR.
  • #2962: Modifies OperatorsSelect.tsx for operator filtering and rendering, related to this PR's refactor of operator categorization and rendering.

Suggested labels

lgtm

Suggested reviewers

  • celdrake
  • ElayAharoni

Poem

In the warren of code, we grouped and we tagged,
Operators sorted, no longer lagged.
Descriptions centralized, support levels in tow,
Now specs are much clearer, as all rabbits know!
🐇✨
Hop along, dear devs, to the next feature show!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 3 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jun 18, 2025

@ammont82: This pull request references MGMT-20483 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 sub-task to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Related with: https://issues.redhat.com/browse/MGMT-20483

Use these categories for operators:
image

image

Summary by CodeRabbit

  • New Features

  • Operators are now organized into categories (e.g., Storage, Virtualization, AI, Network, Remediation, Other) for easier browsing and selection.

  • Added clear, human-readable descriptions for each operator to improve understanding.

  • Refactor

  • Operator selection and display interfaces now group operators by category instead of a flat list.

  • Improved internal handling of operator specifications for consistency across the UI.

  • Style

  • Enhanced operator information presentation for better clarity and user experience.

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.

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: 0

🔭 Outside diff range comments (1)
libs/ui-lib/lib/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.tsx (1)

9-15: Runtime crash when cluster.monitoredOperators is undefined

If monitoredOperators is missing (common for new/draft clusters), ?.filter returns undefined, and the subsequent .map call throws.

-      cluster.monitoredOperators
-        ?.filter(({ name }) => !!name && !!opSpecs[name])
-        .map((op) => {
+      (cluster.monitoredOperators ?? [])
+        .filter(({ name }) => !!name && !!opSpecs[name])
+        .map((op) => {

Guarding with ?? [] ensures the table renders empty instead of crashing.

🧹 Nitpick comments (2)
libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts (1)

49-53: Minor perf/readability nit – fetch specs once

getOperatorSpecsByKey() is invoked five times.
Because it returns a stable, immutable map, cache it once at module scope to avoid repeated work and to keep code DRY.

-import { getOperatorSpecsByKey } from '../../../common/components/operators/operatorSpecs';
+import { getOperatorSpecsByKey } from '../../../common/components/operators/operatorSpecs';
+
+// memoised once per module evaluation
+const OPERATOR_SPECS = getOperatorSpecsByKey();

Then replace the individual const opSpecs = getOperatorSpecsByKey(); lines with OPERATOR_SPECS.

Also applies to: 78-82, 108-112, 128-132, 302-304

libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (1)

463-479: Consider moving enum and categories to the top of the file

For better code organization and readability, consider moving the Category enum and categories mapping to the top of the file, before they are used in the getOperatorSpecs function.

+enum Category {
+  STORAGE,
+  VIRT,
+  AI,
+  NETWORK,
+  REMEDIATION,
+  OTHER,
+}
+
+export const categories: { [key in Category]: string } = {
+  [Category.STORAGE]: 'Storage',
+  [Category.VIRT]: 'Virtualization',
+  [Category.AI]: 'AI',
+  [Category.NETWORK]: 'Network',
+  [Category.REMEDIATION]: 'Remediation',
+  [Category.OTHER]: 'Other',
+};
+
 // TODO check if it's unused and it can be deleted in favor of "isMajorMinorVersionEqualOrGreater"
 export const isOCPVersionEqualsOrMore = (
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 368b2ae and 745e3af.

📒 Files selected for processing (10)
  • libs/ui-lib/lib/common/components/clusterDetail/OperatorsProgressItem.tsx (1 hunks)
  • libs/ui-lib/lib/common/components/operators/operatorDescriptions.tsx (1 hunks)
  • libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (2 hunks)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/OcmOperatorProgressItem.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterDetail/ProgressBarAlerts.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx (3 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx (2 hunks)
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: tests
  • GitHub Check: circular-deps
  • GitHub Check: translation-files
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: format
🔇 Additional comments (10)
libs/ui-lib/lib/common/components/clusterDetail/OperatorsProgressItem.tsx (1)

83-85: Destructuring looks good

Switching to { byKey: opSpecs } is consistent with the new hook contract – no issues spotted here.

libs/ui-lib/lib/ocm/components/clusterConfiguration/OcmOperatorProgressItem.tsx (1)

83-85: Consistent use of byKey

Same change as in the generic component; everything compiles cleanly.

libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx (1)

129-131: ```shell
#!/bin/bash

Search for any occurrence, import, or definition of getNewOperators across the codebase

rg -n "getNewOperators" -C3


</details>
<details>
<summary>libs/ui-lib/lib/ocm/components/clusterDetail/ProgressBarAlerts.tsx (1)</summary>

`69-69`: **LGTM!**

The destructuring of `byKey` from `useOperatorSpecs()` correctly adapts to the new operator specs structure while maintaining the same functionality.

</details>
<details>
<summary>libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx (1)</summary>

`36-36`: **Refactor correctly applied throughout the component**

All changes consistently adapt to the new operator specs structure:
- Import includes the `OperatorSpec` type for proper typing
- Both `BundleLabel` and `BundleCard` components correctly destructure `byKey`
- The `getBundleSupportLevel` function signature properly reflects the new type



Also applies to: 42-42, 84-84, 90-90, 117-117

</details>
<details>
<summary>libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx (2)</summary>

`56-56`: **Excellent implementation of categorized operator display**

The refactor successfully implements the categorized display of operators. The UI now groups operators by their categories, which improves organization and user experience.



Also applies to: 83-108

---

`59-65`: **Verify removal of operator sorting is intentional**

The previous implementation sorted operators by title. With the new categorized display, operators appear in the order they're defined within each category. Is this change intentional?

</details>
<details>
<summary>libs/ui-lib/lib/common/components/operators/operatorDescriptions.tsx (1)</summary>

`1-59`: **Well-structured centralization of operator descriptions**

Excellent separation of concerns by extracting all operator descriptions into a dedicated module. The descriptions are concise, informative, and follow a consistent naming pattern.

</details>
<details>
<summary>libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (2)</summary>

`57-80`: **Excellent implementation of categorized operator specifications**

The refactor successfully:
- Organizes operators into logical categories
- Integrates centralized descriptions
- Maintains backward compatibility via the `byKey` property
- Provides flexible access patterns for different use cases



Also applies to: 96-104, 106-432

---

`434-461`: **Well-designed hook with proper memoization**

The `useOperatorSpecs` hook and `getOperatorSpecsByKey` utility function are well-implemented:
- Proper memoization prevents unnecessary recalculations
- Provides both categorized and flat access patterns
- The utility function enables usage outside React components

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@ammont82 ammont82 requested a review from celdrake June 18, 2025 13:31
@ammont82
Copy link
Member Author

/cherry-pick releases/v2.42

@openshift-cherrypick-robot
Copy link
Contributor

@ammont82: once the present PR merges, I will cherry-pick it on top of releases/v2.42 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick releases/v2.42

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jun 18, 2025

@ammont82: This pull request references MGMT-20483 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 sub-task to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Related with: https://issues.redhat.com/browse/MGMT-20483

Use these categories for operators:
image

image

Summary by CodeRabbit

  • New Features

  • Operators are now organized into categories (Storage, Virtualization, AI, Network, Remediation, Other) for easier browsing and selection.

  • Added clear, human-readable descriptions for each operator to improve understanding.

  • Support levels for operators are now displayed to inform users about feature availability.

  • Refactor

  • Operator selection and display interfaces now group operators by category instead of a flat list.

  • Improved internal handling of operator specifications with streamlined access patterns and enhanced filtering.

  • Disabled reason logic for features updated to provide more nuanced support information.

  • Style

  • Enhanced operator information presentation for better clarity and user experience.

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.

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: 0

🔭 Outside diff range comments (1)
libs/ui-lib/lib/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.tsx (1)

123-136: Parameter name shadows outer constant – leads to accidental undefined propagation

Inside getDisabledReasonCallback, the parameter getFeatureSupportLevel shadows the outer const getFeatureSupportLevel.
If the caller omits this argument (the common case), the inner value is undefined, yet it is the one forwarded to getNewFeatureDisabledReason, so the default implementation is lost.

-      getFeatureSupportLevel?: GetFeatureSupportLevel,
+      getFeatureSupportLevelParam: GetFeatureSupportLevel = getFeatureSupportLevel,
       useLVMS?: boolean,
 …
-        getFeatureSupportLevel,
+        getFeatureSupportLevelParam,
         useLVMS,

This preserves the provider’s own function while still allowing overrides.

♻️ Duplicate comments (1)
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (1)

507-523: Inefficient lookup – repeats earlier feedback

getOperatorSpecByKey still rebuilds all specs and performs an O(N) search each call.
You already expose byKey from useOperatorSpecs; favour that map or create a cached map once.

🧹 Nitpick comments (3)
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (3)

108-112: getOperatorSpecs rebuilds a large object on each call

Every invocation recreates ~200 lines of static data, incurring unnecessary GC pressure. Either:

  1. Memoise on [getFeatureSupportLevel, useLVMS], or
  2. Pre-compute the static parts (title/description) once and only inject supportLevel dynamically.

This pays off when getOperatorSpecByKey and external hooks call the helper frequently.


461-473: Naming mismatch may confuse future maintainers

getOperators takes isSingleClusterFeatureEnabled, but useOperatorSpecs forwards isSingleFeatureEnabled.
Consider renaming the second parameter (or both) to the same identifier to avoid cognitive overhead.


480-486: useLVMS recomputation is fine, but dependency list already covers it – tiny simplification possible

Since useLVMS depends solely on getFeatureSupportLevel, you can inline the boolean into the useMemo that builds byCategory, removing an extra variable:

-  const useLVMS = getFeatureSupportLevel('LVM') === 'supported';
-  const byCategory = React.useMemo(
-    () => getOperatorSpecs(getFeatureSupportLevel, useLVMS),
-    [getFeatureSupportLevel, useLVMS],
-  );
+  const byCategory = React.useMemo(() => {
+    const lvmsEnabled = getFeatureSupportLevel('LVM') === 'supported';
+    return getOperatorSpecs(getFeatureSupportLevel, lvmsEnabled);
+  }, [getFeatureSupportLevel]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 745e3af and bd0d086.

📒 Files selected for processing (7)
  • libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts (1 hunks)
  • libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (4 hunks)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx (2 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx (3 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.tsx (3 hunks)
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: translation-files
  • GitHub Check: circular-deps
  • GitHub Check: unit-tests
  • GitHub Check: tests
  • GitHub Check: lint
  • GitHub Check: format
🔇 Additional comments (2)
libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts (2)

17-21: Type alias relocation and style LGTM

GetFeatureSupportLevel is now properly hoisted and typed – no functional or stylistic issues spotted.


27-29: Confirm downstream call-sites now pass the two new parameters

Adding getFeatureSupportLevel and useLVMS to GetFeatureDisabledReason expands the signature. Make sure every invocation (e.g. in featureStateUtils.ts & consuming UI components) is adjusted; otherwise, TypeScript will silently pass undefined, and disabled-reason logic that relies on these may break.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jun 19, 2025

@ammont82: This pull request references MGMT-20483 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 sub-task to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Related with: https://issues.redhat.com/browse/MGMT-20483

Use these categories for operators:
image

image

Summary by CodeRabbit

  • New Features

  • Operator descriptions are now centrally managed and available for use in the UI.

  • Operators are organized into categories (e.g., Storage, Virtualization, AI) for improved browsing and selection.

  • Operator metadata now includes support level and category information.

  • Refactor

  • Operator specification access is streamlined across multiple components, improving consistency and maintainability.

  • Operator title retrieval is simplified via a new utility function.

  • Operator selection UI now displays operators grouped by category.

  • Chores

  • Updated function and type signatures to support the new operator categorization and metadata.

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.

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: 0

♻️ Duplicate comments (1)
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (1)

483-494: Potential performance issue with repeated operator specs creation.

The function calls getOperatorSpecs(() => undefined) on every invocation, which recreates all operator specifications. For better performance, consider memoizing this or using the existing useOperatorSpecs hook data.

export const getOperatorTitleByFeatureId = (featureId: FeatureId): string | undefined => {
  // Consider memoizing this or accepting the specs as a parameter
  const allSpecs = getOperatorSpecs(() => undefined);
  
  for (const categorySpecs of Object.values(allSpecs)) {
    const spec = categorySpecs.find((s) => s.featureId === featureId);
    if (spec) {
      return spec.title;
    }
  }
  
  return undefined;
};

Also, this addresses the past review comment about getting a single operator spec without building the entire map each time.

🧹 Nitpick comments (1)
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (1)

107-458: Consider refactoring to reduce code duplication.

While the categorized structure is well-organized, the function has significant code duplication across operator definitions. Each operator follows nearly identical patterns with only different values.

Consider extracting a helper function to create operator specs:

const createOperatorSpec = (
  operatorKey: string,
  title: string,
  featureId: FeatureId,
  category: string,
  getFeatureSupportLevel: GetFeatureSupportLevel,
  options: {
    descriptionText?: string;
    Description?: React.ComponentType<{ openshiftVersion?: string }>;
    Requirements?: React.ComponentType<{ cluster: Cluster }>;
    notStandalone?: boolean;
  }
): OperatorSpec => ({
  operatorKey,
  title,
  featureId,
  category,
  supportLevel: getFeatureSupportLevel(featureId),
  ...options,
});

This would reduce duplication and make the operator definitions more maintainable.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd0d086 and b90c142.

📒 Files selected for processing (6)
  • libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts (1 hunks)
  • libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (3 hunks)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx (3 hunks)
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx (2 hunks)
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx
  • libs/ui-lib/lib/common/components/newFeatureSupportLevels/types.ts
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsBundle.tsx
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: unit-tests
  • GitHub Check: tests
  • GitHub Check: translation-files
  • GitHub Check: format
  • GitHub Check: lint
  • GitHub Check: circular-deps
🔇 Additional comments (4)
libs/ui-lib/lib/common/components/operators/operatorSpecs.tsx (4)

2-80: LGTM! Well-organized imports for the refactor.

The new imports for SupportLevel type, GetFeatureSupportLevel hook, and centralized operator descriptions are properly organized and support the categorization refactor effectively.


95-105: Enhanced OperatorSpec type with useful metadata fields.

The additions of operatorKey, descriptionText, category, and supportLevel fields provide better structure and metadata for operator specifications, supporting the categorization goals.


460-481: Efficient implementation with proper memoization.

The hook correctly uses useMemo for both byCategory and byKey maps, ensuring good performance. The flattening logic for byKey is clean and efficient.


496-512: Clean category definitions with proper TypeScript enum usage.

The Category enum and categories mapping provide type-safe category management. The string values are user-friendly and appropriate for UI display.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2025
Copy link
Contributor

@celdrake celdrake left a comment

Choose a reason for hiding this comment

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

Apologies for the suggestion to move logic to the hook, since the module structure would have made the code more complex than it should.

Looks great like this!

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2025
@ammont82 ammont82 modified the milestone: v2.42 Jun 19, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2025
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2025
@openshift-ci
Copy link

openshift-ci bot commented Jun 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ammont82, celdrake, rawagner

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:
  • OWNERS [ammont82,celdrake,rawagner]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 91974ec into openshift-assisted:master Jun 19, 2025
11 checks passed
@openshift-cherrypick-robot
Copy link
Contributor

@ammont82: new pull request created: #3002

Details

In response to this:

/cherry-pick releases/v2.42

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.

ammont82 added a commit to ammont82/assisted-installer-ui that referenced this pull request Sep 12, 2025
* Classify operators by categories

* Improving the categories

* Revert "Improving the categories"

This reverts commit bd0d086.

* Improving categories for operators
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants