Skip to content

MGMT-23515: Use Network type support level#3465

Open
LiorSoffer wants to merge 1 commit intoopenshift-assisted:masterfrom
LiorSoffer:badge
Open

MGMT-23515: Use Network type support level#3465
LiorSoffer wants to merge 1 commit intoopenshift-assisted:masterfrom
LiorSoffer:badge

Conversation

@LiorSoffer
Copy link
Contributor

@LiorSoffer LiorSoffer commented Mar 18, 2026

https://redhat.atlassian.net/browse/MGMT-23515

Summary by CodeRabbit

  • Updates

    • Network type selector now shows a support-level badge for every option and computes per-option support levels for clearer availability info.
    • Network-type definitions were centralized so labels and third-party detection behave consistently across the UI.
    • SDN availability in the selector is now driven by feature support data rather than an external flag.
  • Bug Fixes

    • Disabled-state messaging for SDN selection improved to provide clearer, context-aware reasons.
    • Simplified third-party CNI alert title by removing the "Technology Preview" label.

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

@LiorSoffer: This pull request references MGMT-23515 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 bug to target the "4.22.0" version, but no target version was set.

Details

In response to this:

https://redhat.atlassian.net/browse/MGMT-23515

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 batzionb and rawagner March 18, 2026 16:50
@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 18, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

Network-type constants and third‑party CNI logic were moved into a new networkType types module; various components updated imports. NetworkTypeDropdown now computes per-item feature support via getFeatureSupportLevel and renders NewFeatureSupportLevelBadge; SDN disable/reason logic was centralized and refined.

Changes

Cohort / File(s) Summary
Network type types & exports
libs/ui-lib/lib/common/types/networkType.ts, libs/ui-lib/lib/common/types/index.ts
Added NetworkTypeKey, NETWORK_TYPE_* constants, NETWORK_TYPE_LABELS, NETWORK_TYPE_FEATURE_IDS, and isThirdPartyCNI; re-exported from types index.
Removed config constants
libs/ui-lib/lib/common/config/constants.ts
Removed exported network-type constants and NETWORK_TYPE_LABELS (migrated to new networkType module).
Dropdown / UI rendering
libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx
Removed required isSDNSelectable prop; use getFeatureSupportLevel + NETWORK_TYPE_FEATURE_IDS to compute per-item supportLevel; render NewFeatureSupportLevelBadge for entries; update effect to use getFeatureDisabledReason and set fallback NETWORK_TYPE_OVN; adjusted third‑party CNI alert title.
Feature support & SDN reasons
libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
Added getSDNDisabledReason helper and expanded SDN disabled-reason selection to account for SNO, dual-stack, and unsupported cases.
Import updates across UI
libs/ui-lib/lib/common/components/.../NetworkTypeControlGroup.tsx, .../StackTypeControlGroup.tsx, .../VirtualIPControlGroup.tsx, libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx, libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx, libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx
Switched imports to use new networkType module for NETWORK_TYPE_* and isThirdPartyCNI; removed former config-based imports; stopped passing isSDNSelectable from NetworkConfiguration.
Validation & utilities
libs/ui-lib/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts, libs/ui-lib/lib/ocm/components/utils.ts
Adjusted NETWORK_TYPE_OVN import source to types/networkType; removed isThirdPartyCNI export from utils (relocated to networkType).

Sequence Diagram(s)

sequenceDiagram
    participant UI as NetworkConfiguration UI
    participant Dropdown as NetworkTypeDropdown
    participant FeatureSvc as FeatureSupportLevelService
    participant Cluster as Cluster State

    UI->>Cluster: provide cluster context (isSNO, stack, viewerMode)
    UI->>Dropdown: render with featureSupportLevelData
    Dropdown->>FeatureSvc: getFeatureSupportLevel(NETWORK_TYPE_FEATURE_IDS[value])
    FeatureSvc-->>Dropdown: supportLevel
    Dropdown->>Dropdown: compute disabledReason via getFeatureDisabledReason(featureId, supportLevel)
    alt disabled
        Dropdown->>Cluster: set field value to NETWORK_TYPE_OVN (fallback)
    end
    Dropdown->>UI: render items with NewFeatureSupportLevelBadge/support state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

lgtm, approved

Suggested reviewers

  • rawagner
  • ammont82
  • batzionb

Poem

🐰 I hopped through types and moved a few,
Badges now bloom on each dropdown view,
SDN reasons neat and tidy, too,
Labels found a home brand new —
A tiny hop, a carrot-cheer for you! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'MGMT-23515: Use Network type support level' directly aligns with the PR's main objective of integrating network type support level checks into the UI logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

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

@LiorSoffer LiorSoffer requested a review from ammont82 March 18, 2026 16:50
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx`:
- Around line 94-96: The badge is passed featureId={value} but supportLevel was
derived from the mapped feature id used earlier; update the
NewFeatureSupportLevelBadge call to pass the same mapped feature-id variable
that you used to compute supportLevel (i.e., replace featureId={value} with
featureId={the mapped feature id variable used on lines 80–83}) so the badge
identity and supportLevel are consistent, keeping the existing onClick
event.stopPropagation wrapper intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34f5c746-03c0-488c-aed0-a7c7c152d49f

📥 Commits

Reviewing files that changed from the base of the PR and between a57bb7a and a7dd999.

📒 Files selected for processing (1)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx

@LiorSoffer
Copy link
Contributor Author

/cherry-pick releases/v2.51

@openshift-cherrypick-robot
Copy link
Contributor

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

Details

In response to this:

/cherry-pick releases/v2.51

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.

Comment on lines +80 to +83
const featureId = NETWORK_TYPE_FEATURE_IDS[value];
const supportLevel = featureId
? getFeatureSupportLevel(featureId, featureSupportLevelData ?? undefined)
: undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're looking at support levels for all network types, it makes no sense to treat SDN as a special case. Move the logic for SDN here and let's also future proof in case any of the other network types become unsupported or unavailable in some configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for SDN I first look if isSDNSelectable that's why I treat it differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ignore my last comment I fixed it

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Now let's future proof and disable any option that might be unsupported or unavailable. Not just SDN.

import { isThirdPartyCNI } from '../../utils';
import { RED_HAT_CNI_SUPPORT_MATRIX_LINK } from '../../../../common/config/docs_links';

const NETWORK_TYPE_FEATURE_IDS: Record<string, FeatureSupportLevelId> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have feature support ids here, while values and labels are in a constants.ts file.

I'd move everything into one place. To one file (existing or new), maybe even one object.

You can take inspiration from https://github.com/openshift-assisted/assisted-installer-ui/blob/master/libs/ui-lib/lib/common/types/cpuArchitecture.ts#L52-L72

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2026
@openshift-ci
Copy link

openshift-ci bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LiorSoffer
Once this PR has been reviewed and has the lgtm label, please ask for approval from jgyselov. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 19, 2026
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
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.

♻️ Duplicate comments (1)
libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts (1)

198-200: ⚠️ Potential issue | 🟠 Major

Handle the other network-type feature IDs here too.

NetworkTypeDropdown.tsx now resolves getFeatureDisabledReason(...) for every entry in NETWORK_TYPE_FEATURE_IDS, but this switch only special-cases SDN_NETWORK_TYPE. OVN_NETWORK_TYPE, CISCO_ACI_NETWORK_TYPE, CILIUM_NETWORK_TYPE, CALICO_NETWORK_TYPE, and NONE_NETWORK_TYPE currently fall through to undefined, so unsupported/unavailable options stay selectable and the auto-fallback effect never runs.

Possible fix
+const getGenericNetworkTypeDisabledReason = (isSupported: boolean) =>
+  !isSupported ? 'This network type is not supported for the selected configuration.' : undefined;
+
 export const getNewFeatureDisabledReason = (
   featureId: FeatureId,
   cluster: Cluster | undefined,
   activeFeatureConfiguration: ActiveFeatureConfiguration,
   isSupported: boolean,
@@
     case 'SDN_NETWORK_TYPE': {
       return getSDNDisabledReason(cluster, isSupported);
     }
+    case 'OVN_NETWORK_TYPE':
+    case 'CISCO_ACI_NETWORK_TYPE':
+    case 'CILIUM_NETWORK_TYPE':
+    case 'CALICO_NETWORK_TYPE':
+    case 'NONE_NETWORK_TYPE': {
+      return getGenericNetworkTypeDisabledReason(isSupported);
+    }
     case 'NETWORK_TYPE_SELECTION': {
       return getNetworkTypeSelectionDisabledReason(cluster);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts`
around lines 198 - 200, The switch in getFeatureDisabledReason currently only
handles 'SDN_NETWORK_TYPE' causing other entries from NETWORK_TYPE_FEATURE_IDS
(OVN_NETWORK_TYPE, CISCO_ACI_NETWORK_TYPE, CILIUM_NETWORK_TYPE,
CALICO_NETWORK_TYPE, NONE_NETWORK_TYPE) to fall through; update the switch
inside getFeatureDisabledReason to handle each of those IDs and return the
appropriate disabled-reason helper (e.g., getOVNDisabledReason,
getCiscoACIDisabledReason, getCiliumDisabledReason, getCalicoDisabledReason, or
a shared getNetworkDisabledReason) or create those helper functions if missing
so NetworkTypeDropdown.tsx gets a non-undefined result for every network-type
feature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts`:
- Around line 198-200: The switch in getFeatureDisabledReason currently only
handles 'SDN_NETWORK_TYPE' causing other entries from NETWORK_TYPE_FEATURE_IDS
(OVN_NETWORK_TYPE, CISCO_ACI_NETWORK_TYPE, CILIUM_NETWORK_TYPE,
CALICO_NETWORK_TYPE, NONE_NETWORK_TYPE) to fall through; update the switch
inside getFeatureDisabledReason to handle each of those IDs and return the
appropriate disabled-reason helper (e.g., getOVNDisabledReason,
getCiscoACIDisabledReason, getCiliumDisabledReason, getCalicoDisabledReason, or
a shared getNetworkDisabledReason) or create those helper functions if missing
so NetworkTypeDropdown.tsx gets a non-undefined result for every network-type
feature.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd1d7a1d-ce91-4583-a487-af3fb08fdb3e

📥 Commits

Reviewing files that changed from the base of the PR and between 524777a and 9148af6.

📒 Files selected for processing (13)
  • libs/ui-lib/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx
  • libs/ui-lib/lib/common/config/constants.ts
  • libs/ui-lib/lib/common/types/index.ts
  • libs/ui-lib/lib/common/types/networkType.ts
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
  • libs/ui-lib/lib/ocm/components/utils.ts
💤 Files with no reviewable changes (3)
  • libs/ui-lib/lib/common/config/constants.ts
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx
  • libs/ui-lib/lib/ocm/components/utils.ts
✅ Files skipped from review due to trivial changes (7)
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx
  • libs/ui-lib/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts
  • libs/ui-lib/lib/common/types/index.ts
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx

@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2026
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx`:
- Around line 46-55: The effect in NetworkTypeDropdown.tsx that forces
setValue(NETWORK_TYPE_OVN) when getFeatureDisabledReason(...) !== undefined
should early-return if the dropdown is disabled; modify the React.useEffect to
check the component's isDisabled prop (or the local variable controlling
disabled state) and skip calling setValue when isDisabled is true, so the effect
only updates Formik state when the control is interactive; keep the existing
checks on field.value, featureSupportLevelData, getFeatureDisabledReason and
only call setValue(NETWORK_TYPE_OVN) when the feature is unsupported AND
isDisabled is false.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 448d768a-ab8e-4da4-8f28-0e39bf5616b2

📥 Commits

Reviewing files that changed from the base of the PR and between 9148af6 and 3cb87df.

📒 Files selected for processing (13)
  • libs/ui-lib/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx
  • libs/ui-lib/lib/common/config/constants.ts
  • libs/ui-lib/lib/common/types/index.ts
  • libs/ui-lib/lib/common/types/networkType.ts
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx
  • libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
  • libs/ui-lib/lib/ocm/components/utils.ts
💤 Files with no reviewable changes (3)
  • libs/ui-lib/lib/ocm/components/utils.ts
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx
  • libs/ui-lib/lib/common/config/constants.ts
✅ Files skipped from review due to trivial changes (9)
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx
  • libs/ui-lib/lib/common/types/index.ts
  • libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx
  • libs/ui-lib/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx
  • libs/ui-lib/lib/ocm/components/featureSupportLevels/featureStateUtils.ts
  • libs/ui-lib/lib/common/types/networkType.ts
  • libs/ui-lib/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts

Comment on lines 46 to +55
React.useEffect(() => {
if (field.value === NETWORK_TYPE_SDN && sdnDisabledReason) {
if (
getFeatureDisabledReason(
NETWORK_TYPE_FEATURE_IDS[field.value],
featureSupportLevelData ?? undefined,
) !== undefined
) {
setValue(NETWORK_TYPE_OVN);
}
}, [sdnDisabledReason, field.value, setValue]);
}, [field.value, setValue, featureSupportLevelData, getFeatureDisabledReason]);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Skip the auto-fallback when the dropdown is disabled.

This effect still forces NETWORK_TYPE_OVN when the selected type becomes unavailable/unsupported, even if isDisabled is true. That lets a read-only control silently rewrite the displayed selection and Formik state.

💡 Suggested fix
  React.useEffect(() => {
+   if (isDisabled) {
+     return;
+   }
    if (
      getFeatureDisabledReason(
        NETWORK_TYPE_FEATURE_IDS[field.value],
        featureSupportLevelData ?? undefined,
      ) !== undefined
    ) {
      setValue(NETWORK_TYPE_OVN);
    }
- }, [field.value, setValue, featureSupportLevelData, getFeatureDisabledReason]);
+ }, [field.value, isDisabled, setValue, featureSupportLevelData, getFeatureDisabledReason]);
📝 Committable suggestion

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

Suggested change
React.useEffect(() => {
if (field.value === NETWORK_TYPE_SDN && sdnDisabledReason) {
if (
getFeatureDisabledReason(
NETWORK_TYPE_FEATURE_IDS[field.value],
featureSupportLevelData ?? undefined,
) !== undefined
) {
setValue(NETWORK_TYPE_OVN);
}
}, [sdnDisabledReason, field.value, setValue]);
}, [field.value, setValue, featureSupportLevelData, getFeatureDisabledReason]);
React.useEffect(() => {
if (isDisabled) {
return;
}
if (
getFeatureDisabledReason(
NETWORK_TYPE_FEATURE_IDS[field.value],
featureSupportLevelData ?? undefined,
) !== undefined
) {
setValue(NETWORK_TYPE_OVN);
}
}, [field.value, isDisabled, setValue, featureSupportLevelData, getFeatureDisabledReason]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx`
around lines 46 - 55, The effect in NetworkTypeDropdown.tsx that forces
setValue(NETWORK_TYPE_OVN) when getFeatureDisabledReason(...) !== undefined
should early-return if the dropdown is disabled; modify the React.useEffect to
check the component's isDisabled prop (or the local variable controlling
disabled state) and skip calling setValue when isDisabled is true, so the effect
only updates Formik state when the control is interactive; keep the existing
checks on field.value, featureSupportLevelData, getFeatureDisabledReason and
only call setValue(NETWORK_TYPE_OVN) when the feature is unsupported AND
isDisabled is false.

Copy link
Contributor

@jgyselov jgyselov left a comment

Choose a reason for hiding this comment

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

See if you can simplify the imports 🙂

If we kept importing like this, we'd end up with hundreds of lines of imports and no-one wants that.

Comment on lines +7 to +8
import { DUAL_STACK, IPV4_STACK } from '../../../common/config';
import { NETWORK_TYPE_OVN } from '../../../common/types/networkType';
Copy link
Contributor

Choose a reason for hiding this comment

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

You could just import all from ./../../common

NO_SUBNET_SET,
} from '../../../config';
import { DUAL_STACK, IPV4_STACK, NO_SUBNET_SET } from '../../../config';
import { NETWORK_TYPE_OVN, NETWORK_TYPE_SDN } from '../../../types/networkType';
Copy link
Contributor

Choose a reason for hiding this comment

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

You could import from ../../../types

import { NetworkConfigurationValues, HostSubnets } from '../../../types';
import { NETWORK_TYPE_SDN, DUAL_STACK } from '../../../config';
import { DUAL_STACK } from '../../../config';
import { NETWORK_TYPE_SDN } from '../../../types/networkType';
Copy link
Contributor

Choose a reason for hiding this comment

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

You could import from ../../../types

import { getFieldId } from '../../../../common/components/ui/formik';
import { isOciPlatformType, isThirdPartyCNI } from '../../utils';
import { isOciPlatformType } from '../../utils';
import { isThirdPartyCNI } from '../../../../common/types/networkType';
Copy link
Contributor

Choose a reason for hiding this comment

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

You could import from ../../../../common

import { useFeature } from '../../hooks/use-feature';
import { isOciPlatformType, isThirdPartyCNI } from '../utils';
import { isOciPlatformType } from '../utils';
import { isThirdPartyCNI } from '../../../common/types/networkType';
Copy link
Contributor

Choose a reason for hiding this comment

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

You could import from ../../../common

Comment on lines +80 to +83
const featureId = NETWORK_TYPE_FEATURE_IDS[value];
const supportLevel = featureId
? getFeatureSupportLevel(featureId, featureSupportLevelData ?? undefined)
: undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Now let's future proof and disable any option that might be unsupported or unavailable. Not just SDN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants