@openshift-assisted/ui-lib 2.42.0 → 2.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/build/@types/common/components/newFeatureSupportLevels/types.d.ts +1 -1
  2. package/build/@types/common/components/newFeatureSupportLevels/types.d.ts.map +1 -1
  3. package/build/@types/common/components/operators/operatorDescriptions.d.ts +23 -0
  4. package/build/@types/common/components/operators/operatorDescriptions.d.ts.map +1 -0
  5. package/build/@types/common/components/operators/operatorSpecs.d.ts +25 -4
  6. package/build/@types/common/components/operators/operatorSpecs.d.ts.map +1 -1
  7. package/build/@types/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts +2 -0
  8. package/build/@types/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts.map +1 -1
  9. package/build/@types/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.d.ts.map +1 -1
  10. package/build/@types/ocm/components/clusterConfiguration/manifestsConfiguration/components/FolderDropdown.d.ts.map +1 -1
  11. package/build/@types/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.d.ts.map +1 -1
  12. package/build/@types/ocm/components/clusterWizard/OperatorsBundle.d.ts.map +1 -1
  13. package/build/@types/ocm/components/clusterWizard/OperatorsSelect.d.ts.map +1 -1
  14. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  15. package/build/cjs/common/components/clusterDetail/OperatorsProgressItem.js +1 -1
  16. package/build/cjs/common/components/clusterDetail/OperatorsProgressItem.js.map +1 -1
  17. package/build/cjs/common/components/operators/operatorDescriptions.js +26 -0
  18. package/build/cjs/common/components/operators/operatorDescriptions.js.map +1 -0
  19. package/build/cjs/common/components/operators/operatorSpecs.js +331 -190
  20. package/build/cjs/common/components/operators/operatorSpecs.js.map +1 -1
  21. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js +7 -6
  22. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js.map +1 -1
  23. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js +16 -0
  24. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js.map +1 -1
  25. package/build/cjs/ocm/components/clusterConfiguration/OcmOperatorProgressItem.js +1 -1
  26. package/build/cjs/ocm/components/clusterConfiguration/OcmOperatorProgressItem.js.map +1 -1
  27. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/components/FolderDropdown.js +1 -1
  28. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/components/FolderDropdown.js.map +1 -1
  29. package/build/cjs/ocm/components/clusterConfiguration/operators/OperatorCheckbox.js +1 -1
  30. package/build/cjs/ocm/components/clusterConfiguration/operators/OperatorCheckbox.js.map +1 -1
  31. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.js +1 -1
  32. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.js.map +1 -1
  33. package/build/cjs/ocm/components/clusterDetail/ProgressBarAlerts.js +1 -1
  34. package/build/cjs/ocm/components/clusterDetail/ProgressBarAlerts.js.map +1 -1
  35. package/build/cjs/ocm/components/clusterWizard/OperatorsBundle.js +9 -10
  36. package/build/cjs/ocm/components/clusterWizard/OperatorsBundle.js.map +1 -1
  37. package/build/cjs/ocm/components/clusterWizard/OperatorsSelect.js +11 -14
  38. package/build/cjs/ocm/components/clusterWizard/OperatorsSelect.js.map +1 -1
  39. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +5 -15
  40. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  41. package/lib/common/components/clusterDetail/OperatorsProgressItem.tsx +1 -1
  42. package/lib/common/components/newFeatureSupportLevels/types.ts +1 -0
  43. package/lib/common/components/operators/operatorDescriptions.tsx +58 -0
  44. package/lib/common/components/operators/operatorSpecs.tsx +422 -257
  45. package/lib/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +5 -5
  46. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +33 -1
  47. package/lib/ocm/components/clusterConfiguration/OcmOperatorProgressItem.tsx +1 -1
  48. package/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/FolderDropdown.tsx +1 -0
  49. package/lib/ocm/components/clusterConfiguration/operators/OperatorCheckbox.tsx +1 -1
  50. package/lib/ocm/components/clusterConfiguration/review/ReviewOperatorsTable.tsx +2 -1
  51. package/lib/ocm/components/clusterDetail/ProgressBarAlerts.tsx +1 -1
  52. package/lib/ocm/components/clusterWizard/OperatorsBundle.tsx +11 -17
  53. package/lib/ocm/components/clusterWizard/OperatorsSelect.tsx +28 -26
  54. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +7 -18
  55. package/package.json +3 -3
@@ -20,7 +20,7 @@ import OcmSNODisclaimer from './OcmSNODisclaimer';
20
20
 
21
21
  const INPUT_NAME = 'controlPlaneCount';
22
22
  const fieldId = getFieldId(INPUT_NAME, 'input');
23
- const DEFAULT_VALUE = 3;
23
+ export const DEFAULT_VALUE_CPN = 3;
24
24
 
25
25
  export const ControlPlaneNodesLabel = () => {
26
26
  return (
@@ -48,7 +48,7 @@ interface ControlPlaneNodesDropdownProps {
48
48
  featureSupportLevelData?: NewFeatureSupportLevelMap | null;
49
49
  }
50
50
 
51
- const isDropdownItemEnabled = (
51
+ export const isCPNDropdownItemEnabled = (
52
52
  controlPlaneNodeCount: number,
53
53
  isNonStandardControlPlaneEnabled: boolean,
54
54
  isTnaEnabled: boolean,
@@ -83,7 +83,7 @@ const ControlPlaneNodesDropdown: React.FC<ControlPlaneNodesDropdownProps> = ({
83
83
  );
84
84
 
85
85
  const disabledReason =
86
- 'This option is not available with the current configurations. Make sure that OpenShift version is 4.18 or newer, CPU architecture is x86_64 and no external platform integration is selected.';
86
+ 'This option is not available with the current configurations. Make sure that OpenShift version is 4.19 or newer and no external platform integration is selected.';
87
87
 
88
88
  const isNonStandardControlPlaneEnabled = newFeatureSupportLevelContext.isFeatureSupported(
89
89
  'NON_STANDARD_HA_CONTROL_PLANE',
@@ -105,7 +105,7 @@ const ControlPlaneNodesDropdown: React.FC<ControlPlaneNodesDropdownProps> = ({
105
105
 
106
106
  React.useEffect(() => {
107
107
  if (!field.value) {
108
- setValue(DEFAULT_VALUE);
108
+ setValue(DEFAULT_VALUE_CPN);
109
109
  }
110
110
  }, [field.value, setValue]);
111
111
 
@@ -116,7 +116,7 @@ const ControlPlaneNodesDropdown: React.FC<ControlPlaneNodesDropdownProps> = ({
116
116
  };
117
117
 
118
118
  const dropdownItems = options.map(({ value, label }) => {
119
- const isItemEnabled = isDropdownItemEnabled(
119
+ const isItemEnabled = isCPNDropdownItemEnabled(
120
120
  value,
121
121
  isNonStandardControlPlaneEnabled,
122
122
  isTnaEnabled,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  import * as React from 'react';
2
3
  import { Form } from '@patternfly/react-core';
3
4
  import { useFormikContext } from 'formik';
@@ -32,7 +33,11 @@ import { ExternalPlatformLabels } from './platformIntegration/constants';
32
33
  import { ManagedDomain, PlatformType } from '@openshift-assisted/types/assisted-installer-service';
33
34
  import { useClusterWizardContext } from '../clusterWizard/ClusterWizardContext';
34
35
  import { useFeature } from '../../hooks/use-feature';
35
- import ControlPlaneNodesDropdown, { ControlPlaneNodesLabel } from './ControlPlaneNodesDropdown';
36
+ import ControlPlaneNodesDropdown, {
37
+ ControlPlaneNodesLabel,
38
+ DEFAULT_VALUE_CPN,
39
+ isCPNDropdownItemEnabled,
40
+ } from './ControlPlaneNodesDropdown';
36
41
 
37
42
  export type OcmClusterDetailsFormFieldsProps = {
38
43
  forceOpenshiftVersion?: string;
@@ -115,6 +120,33 @@ export const OcmClusterDetailsFormFields = ({
115
120
  );
116
121
  }, [setFieldValue, featureSupportLevelContext, featureSupportLevelData]);
117
122
 
123
+ React.useEffect(() => {
124
+ const currentCount = values.controlPlaneCount;
125
+ const isNonStandardControlPlaneEnabled = featureSupportLevelContext.isFeatureSupported(
126
+ 'NON_STANDARD_HA_CONTROL_PLANE',
127
+ featureSupportLevelData ?? undefined,
128
+ );
129
+ const isTnaEnabled = featureSupportLevelContext.isFeatureSupported(
130
+ 'TNA',
131
+ featureSupportLevelData ?? undefined,
132
+ );
133
+
134
+ const isItemEnabled = isCPNDropdownItemEnabled(
135
+ currentCount,
136
+ isNonStandardControlPlaneEnabled,
137
+ isTnaEnabled,
138
+ );
139
+
140
+ if (!isItemEnabled) {
141
+ setFieldValue('controlPlaneCount', DEFAULT_VALUE_CPN, false);
142
+ }
143
+ }, [
144
+ values.openshiftVersion,
145
+ featureSupportLevelData,
146
+ featureSupportLevelContext,
147
+ values.controlPlaneCount,
148
+ setFieldValue,
149
+ ]);
118
150
  return (
119
151
  <Form id="wizard-cluster-details__form">
120
152
  <OcmRichInputField
@@ -80,7 +80,7 @@ type OperatorsPopoverProps = OperatorListProps & {
80
80
 
81
81
  const OperatorsPopover = ({ operators, children }: OperatorsPopoverProps) => {
82
82
  const { t } = useTranslation();
83
- const opSpecs = useOperatorSpecs();
83
+ const { byKey: opSpecs } = useOperatorSpecs();
84
84
 
85
85
  return (
86
86
  <Popover
@@ -56,6 +56,7 @@ export const FolderDropdown = ({ name }: FolderDropdownProps) => {
56
56
  onClick={() => setOpen(!isOpen)}
57
57
  isExpanded={isOpen}
58
58
  className="pf-v5-u-w-100"
59
+ id={fieldId}
59
60
  >
60
61
  {value || 'manifests'}
61
62
  </MenuToggle>
@@ -126,7 +126,7 @@ const OperatorCheckbox = ({
126
126
  preflightRequirements: PreflightHardwareRequirements | undefined;
127
127
  } & OperatorSpec) => {
128
128
  const { getFeatureSupportLevel, getFeatureDisabledReason } = useNewFeatureSupportLevel();
129
- const opSpecs = useOperatorSpecs();
129
+ const { byKey: opSpecs } = useOperatorSpecs();
130
130
 
131
131
  const { isViewerMode } = useSelector(selectCurrentClusterPermissionsState);
132
132
  const { values, setFieldValue } = useFormikContext<OperatorsValues>();
@@ -6,7 +6,8 @@ import { TableSummaryExpandable } from './TableSummaryExpandable';
6
6
  import { useOperatorSpecs } from '../../../../common/components/operators/operatorSpecs';
7
7
 
8
8
  export const ReviewOperatorsTable = ({ cluster }: { cluster: Cluster }) => {
9
- const opSpecs = useOperatorSpecs();
9
+ const { byKey: opSpecs } = useOperatorSpecs();
10
+
10
11
  const rows = React.useMemo(
11
12
  () =>
12
13
  cluster.monitoredOperators
@@ -66,7 +66,7 @@ export const HostInstallationWarning = ({
66
66
  message,
67
67
  }: InstallationProgressWarningProps) => {
68
68
  const { addAlert, clearAlerts } = useAlerts();
69
- const opSpecs = useOperatorSpecs();
69
+ const { byKey: opSpecs } = useOperatorSpecs();
70
70
 
71
71
  return (
72
72
  <>
@@ -24,22 +24,18 @@ import NewFeatureSupportLevelBadge, {
24
24
  } from '../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
25
25
  import { ExternalLink, OperatorsValues, PopoverIcon, singleClusterBundles } from '../../../common';
26
26
  import { useFormikContext } from 'formik';
27
- import {
28
- GetFeatureSupportLevel,
29
- useNewFeatureSupportLevel,
30
- } from '../../../common/components/newFeatureSupportLevels';
27
+ import { useNewFeatureSupportLevel } from '../../../common/components/newFeatureSupportLevels';
31
28
  import { useFeature } from '../../hooks/use-feature';
32
29
  import { useSelector } from 'react-redux';
33
30
  import { selectIsCurrentClusterSNO } from '../../store/slices/current-cluster/selectors';
34
31
  import { getNewBundleOperators } from '../clusterConfiguration/operators/utils';
35
32
  import { bundleSpecs } from '../clusterConfiguration/operators/bundleSpecs';
36
- import { useOperatorSpecs } from '../../../common/components/operators/operatorSpecs';
37
-
38
- import './OperatorsBundle.css';
33
+ import { OperatorSpec, useOperatorSpecs } from '../../../common/components/operators/operatorSpecs';
39
34
  import { useClusterWizardContext } from './ClusterWizardContext';
35
+ import './OperatorsBundle.css';
40
36
 
41
37
  const BundleLabel = ({ bundle }: { bundle: Bundle }) => {
42
- const opSpecs = useOperatorSpecs();
38
+ const { byKey: opSpecs } = useOperatorSpecs();
43
39
  const bundleSpec = bundleSpecs[bundle.id || ''];
44
40
 
45
41
  return (
@@ -81,19 +77,17 @@ const BundleLabel = ({ bundle }: { bundle: Bundle }) => {
81
77
 
82
78
  const getBundleSupportLevel = (
83
79
  bundle: Bundle,
84
- opSpecs: ReturnType<typeof useOperatorSpecs>,
85
- getFeatureSupportLevel: GetFeatureSupportLevel,
80
+ opSpecsByKey: Record<string, OperatorSpec>,
86
81
  ): NewSupportLevelBadgeProps['supportLevel'] => {
87
82
  let supportLevel: NewSupportLevelBadgeProps['supportLevel'] = undefined;
88
83
  if (bundle.operators) {
89
84
  for (const op of bundle.operators) {
90
- const operatorSpec = opSpecs[op];
85
+ const operatorSpec = opSpecsByKey[op];
91
86
  if (operatorSpec) {
92
- const opSupportLevel = getFeatureSupportLevel(operatorSpec.featureId);
93
- if (opSupportLevel === 'dev-preview') {
87
+ if (operatorSpec.supportLevel === 'dev-preview') {
94
88
  supportLevel = 'dev-preview';
95
89
  break;
96
- } else if (opSupportLevel === 'tech-preview') {
90
+ } else if (operatorSpec.supportLevel === 'tech-preview') {
97
91
  supportLevel = 'tech-preview';
98
92
  }
99
93
  }
@@ -113,11 +107,11 @@ const BundleCard = ({
113
107
  }) => {
114
108
  const { values, setFieldValue } = useFormikContext<OperatorsValues>();
115
109
  const isSNO = useSelector(selectIsCurrentClusterSNO);
116
- const { isFeatureSupported, getFeatureSupportLevel } = useNewFeatureSupportLevel();
117
- const opSpecs = useOperatorSpecs();
110
+ const { isFeatureSupported } = useNewFeatureSupportLevel();
111
+ const { byKey: opSpecs } = useOperatorSpecs();
118
112
  const { uiSettings } = useClusterWizardContext();
119
113
 
120
- const supportLevel = getBundleSupportLevel(bundle, opSpecs, getFeatureSupportLevel);
114
+ const supportLevel = getBundleSupportLevel(bundle, opSpecs);
121
115
 
122
116
  const hasUnsupportedOperators = !!bundle.operators?.some((op) => {
123
117
  const operatorSpec = opSpecs[op];
@@ -53,22 +53,16 @@ const OperatorsSelect = ({
53
53
  void fetchSupportedOperators();
54
54
  }, [addAlert, setSupportedOperators, setIsLoading]);
55
55
 
56
- const opSpecs = useOperatorSpecs();
56
+ const { byCategory, byKey: opSpecs } = useOperatorSpecs();
57
57
 
58
58
  const operators = React.useMemo(() => {
59
- return supportedOperators
60
- .sort((a, b) => {
61
- const aTitle = opSpecs[a]?.title || a;
62
- const bTitle = opSpecs[b]?.title || b;
63
- return aTitle.localeCompare(bTitle);
64
- })
65
- .filter((op) => {
66
- if (!isSingleClusterFeatureEnabled) {
67
- return true;
68
- }
69
- return singleClusterOperators.includes(op);
70
- });
71
- }, [isSingleClusterFeatureEnabled, supportedOperators, opSpecs]);
59
+ return supportedOperators.filter((op) => {
60
+ if (!isSingleClusterFeatureEnabled) {
61
+ return true;
62
+ }
63
+ return singleClusterOperators.includes(op);
64
+ });
65
+ }, [isSingleClusterFeatureEnabled, supportedOperators]);
72
66
 
73
67
  if (isLoading) {
74
68
  return <LoadingState />;
@@ -86,22 +80,30 @@ const OperatorsSelect = ({
86
80
  data-testid="single-operators-section"
87
81
  >
88
82
  <Stack hasGutter data-testid={'operators-form'}>
89
- {operators.map((operatorKey) => {
90
- if (!opSpecs[operatorKey]) {
83
+ {Object.entries(byCategory).map(([categoryName, specs]) => {
84
+ const categoryOperators = specs.filter((spec) => operators.includes(spec.operatorKey));
85
+ if (categoryOperators.length === 0) {
91
86
  return null;
92
87
  }
93
88
 
94
89
  return (
95
- <StackItem key={operatorKey}>
96
- <OperatorCheckbox
97
- bundles={bundles}
98
- operatorId={operatorKey}
99
- cluster={cluster}
100
- openshiftVersion={cluster.openshiftVersion}
101
- preflightRequirements={preflightRequirements}
102
- {...opSpecs[operatorKey]}
103
- />
104
- </StackItem>
90
+ <React.Fragment key={categoryName}>
91
+ <StackItem>
92
+ <strong>{categoryName}</strong>
93
+ </StackItem>
94
+ {categoryOperators.map((spec) => (
95
+ <StackItem key={spec.operatorKey}>
96
+ <OperatorCheckbox
97
+ bundles={bundles}
98
+ operatorId={spec.operatorKey}
99
+ cluster={cluster}
100
+ openshiftVersion={cluster.openshiftVersion}
101
+ preflightRequirements={preflightRequirements}
102
+ {...spec}
103
+ />
104
+ </StackItem>
105
+ ))}
106
+ </React.Fragment>
105
107
  );
106
108
  })}
107
109
  </Stack>
@@ -4,11 +4,6 @@ import {
4
4
  CpuArchitecture,
5
5
  FeatureId,
6
6
  isSNO,
7
- OPERATOR_NAME_CNV,
8
- OPERATOR_NAME_LVM,
9
- OPERATOR_NAME_ODF,
10
- OPERATOR_NAME_OPENSHIFT_AI,
11
- OPERATOR_NAME_OSC,
12
7
  SupportedCpuArchitecture,
13
8
  } from '../../../common';
14
9
  import {
@@ -17,7 +12,7 @@ import {
17
12
  SupportLevel,
18
13
  } from '@openshift-assisted/types/assisted-installer-service';
19
14
  import { ExternalPlatformLabels } from '../clusterConfiguration/platformIntegration/constants';
20
- import { getOperatorSpecs } from '../../../common/components/operators/operatorSpecs';
15
+ import { getOperatorTitleByFeatureId } from '../../../common/components/operators/operatorSpecs';
21
16
 
22
17
  export const clusterExistsReason = 'This option is not editable after the draft cluster is created';
23
18
 
@@ -46,10 +41,7 @@ const getOdfDisabledReason = (
46
41
  return undefined;
47
42
  }
48
43
 
49
- const opSpecs = getOperatorSpecs();
50
-
51
- const operatorTitle = opSpecs[OPERATOR_NAME_ODF]?.title || '';
52
-
44
+ const operatorTitle = getOperatorTitleByFeatureId('ODF') || '';
53
45
  const isArm = activeFeatureConfiguration?.underlyingCpuArchitecture === CpuArchitecture.ARM;
54
46
  if (isArm && isSNO(cluster)) {
55
47
  return `${operatorTitle} is not available when using Single Node OpenShift or ARM CPU architecture.`;
@@ -75,8 +67,8 @@ const getCnvDisabledReason = (
75
67
  return undefined;
76
68
  }
77
69
 
78
- const opSpecs = getOperatorSpecs();
79
- const operatorTitle = opSpecs[OPERATOR_NAME_CNV]?.title || '';
70
+ const operatorTitle = getOperatorTitleByFeatureId('CNV') || '';
71
+
80
72
  if (platformType === 'nutanix') {
81
73
  return `${operatorTitle} is not available when Nutanix platform type is selected.`;
82
74
  }
@@ -105,8 +97,7 @@ const getLvmDisabledReason = (
105
97
  return undefined;
106
98
  }
107
99
 
108
- const opSpecs = getOperatorSpecs();
109
- const operatorTitle = opSpecs[OPERATOR_NAME_LVM]?.title;
100
+ const operatorTitle = getOperatorTitleByFeatureId('LVM') || '';
110
101
  if (platformType === 'nutanix') {
111
102
  return `${operatorTitle} is not supported when Nutanix platform type is selected.`;
112
103
  }
@@ -125,8 +116,7 @@ const getOscDisabledReason = (
125
116
  return undefined;
126
117
  }
127
118
 
128
- const opSpecs = getOperatorSpecs();
129
- const operatorTitle = opSpecs[OPERATOR_NAME_OSC]?.title || '';
119
+ const operatorTitle = getOperatorTitleByFeatureId('OSC') || '';
130
120
  if (!isSupported) {
131
121
  return `${operatorTitle} is not supported in this OpenShift version.`;
132
122
  }
@@ -299,8 +289,7 @@ const getOpenShiftAIDisabledReason = (
299
289
  return undefined;
300
290
  }
301
291
 
302
- const opSpecs = getOperatorSpecs();
303
- const operatorTitle = opSpecs[OPERATOR_NAME_OPENSHIFT_AI]?.title || '';
292
+ const operatorTitle = getOperatorTitleByFeatureId('OPENSHIFT_AI') || '';
304
293
  const isArm = activeFeatureConfiguration?.underlyingCpuArchitecture === CpuArchitecture.ARM;
305
294
  if (isArm) {
306
295
  return `${operatorTitle} is not available when ARM CPU architecture is selected.`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.42.0",
4
- "@openshift-assisted/types": "2.42.0",
3
+ "@openshift-assisted/locales": "2.42.1",
4
+ "@openshift-assisted/types": "2.42.1",
5
5
  "@openshift-console/dynamic-plugin-sdk": "0.0.3",
6
6
  "@patternfly/patternfly": "5.2.0",
7
7
  "@patternfly/react-code-editor": "5.2.0",
@@ -140,5 +140,5 @@
140
140
  ]
141
141
  }
142
142
  },
143
- "version": "2.42.0"
143
+ "version": "2.42.1"
144
144
  }