@openshift-assisted/ui-lib 2.12.0-cim → 2.13.0-cim

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 (109) hide show
  1. package/build/@types/cim/components/Agent/NoAgentsAlert.d.ts.map +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts +2 -0
  3. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts.map +1 -1
  4. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts +2 -1
  5. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
  6. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts +3 -5
  7. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts.map +1 -1
  8. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts +1 -0
  9. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  10. package/build/@types/cim/components/InfraEnv/EnvironmentDetails.d.ts.map +1 -1
  11. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +5 -1
  12. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
  13. package/build/@types/cim/components/InfraEnv/InfraTableToolbar.d.ts.map +1 -1
  14. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts +6 -0
  15. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts.map +1 -0
  16. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +6 -0
  17. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -0
  18. package/build/@types/cim/components/helpers/agentStatus.d.ts.map +1 -1
  19. package/build/@types/cim/components/helpers/clusterDeployment.d.ts +1 -1
  20. package/build/@types/cim/components/helpers/clusterDeployment.d.ts.map +1 -1
  21. package/build/@types/cim/components/helpers/versions.d.ts +2 -2
  22. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  23. package/build/@types/cim/types/k8s/agent-service-config.d.ts +7 -0
  24. package/build/@types/cim/types/k8s/agent-service-config.d.ts.map +1 -1
  25. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +2 -1
  26. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
  27. package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
  28. package/build/@types/common/components/clusterWizard/types.d.ts +1 -0
  29. package/build/@types/common/components/clusterWizard/types.d.ts.map +1 -1
  30. package/build/@types/common/components/hosts/utils.d.ts.map +1 -1
  31. package/build/@types/common/types/cpuArchitecture.d.ts +6 -0
  32. package/build/@types/common/types/cpuArchitecture.d.ts.map +1 -1
  33. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts +1 -7
  34. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts.map +1 -1
  35. package/build/@types/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.d.ts.map +1 -1
  36. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.d.ts.map +1 -1
  37. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  38. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +1 -1
  39. package/build/cjs/cim/components/Agent/NoAgentsAlert.js +10 -5
  40. package/build/cjs/cim/components/Agent/NoAgentsAlert.js.map +1 -1
  41. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js +7 -6
  42. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js.map +1 -1
  43. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +19 -4
  44. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
  45. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js +4 -5
  46. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js.map +1 -1
  47. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +3 -3
  48. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  49. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js +12 -8
  50. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js.map +1 -1
  51. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +6 -10
  52. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  53. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js +1 -4
  54. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js.map +1 -1
  55. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js +34 -0
  56. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js.map +1 -0
  57. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +46 -0
  58. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -0
  59. package/build/cjs/cim/components/helpers/agentStatus.js +5 -0
  60. package/build/cjs/cim/components/helpers/agentStatus.js.map +1 -1
  61. package/build/cjs/cim/components/helpers/clusterDeployment.js +8 -1
  62. package/build/cjs/cim/components/helpers/clusterDeployment.js.map +1 -1
  63. package/build/cjs/cim/components/helpers/versions.js +6 -1
  64. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  65. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +1 -0
  66. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
  67. package/build/cjs/common/components/hosts/utils.js +1 -0
  68. package/build/cjs/common/components/hosts/utils.js.map +1 -1
  69. package/build/cjs/common/components/ui/formik/LabelField.css +5 -0
  70. package/build/cjs/common/types/cpuArchitecture.js +22 -1
  71. package/build/cjs/common/types/cpuArchitecture.js.map +1 -1
  72. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js +5 -27
  73. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js.map +1 -1
  74. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js +2 -4
  75. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js.map +1 -1
  76. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js +1 -2
  77. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js.map +1 -1
  78. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +1 -2
  79. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  80. package/lib/cim/components/Agent/NoAgentsAlert.tsx +8 -4
  81. package/lib/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.tsx +17 -3
  82. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +30 -4
  83. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.tsx +9 -9
  84. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +5 -3
  85. package/lib/cim/components/InfraEnv/EnvironmentDetails.tsx +18 -2
  86. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +15 -22
  87. package/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +1 -3
  88. package/lib/cim/components/InfraEnv/OpenshiftVersionDropdown.tsx +71 -0
  89. package/lib/cim/components/common/CpuArchitectureDropdown.tsx +93 -0
  90. package/lib/cim/components/helpers/agentStatus.tsx +5 -0
  91. package/lib/cim/components/helpers/clusterDeployment.ts +8 -1
  92. package/lib/cim/components/helpers/versions.ts +12 -0
  93. package/lib/cim/types/k8s/agent-service-config.ts +8 -0
  94. package/lib/cim/types/k8s/infra-env-k8s-resource.ts +2 -1
  95. package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +1 -0
  96. package/lib/common/components/clusterWizard/types.ts +1 -0
  97. package/lib/common/components/hosts/utils.ts +2 -0
  98. package/lib/common/components/ui/formik/LabelField.css +5 -0
  99. package/lib/common/types/cpuArchitecture.ts +28 -0
  100. package/lib/ocm/components/clusterConfiguration/CpuArchitectureDropdown.tsx +2 -33
  101. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +4 -7
  102. package/lib/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.tsx +1 -1
  103. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +1 -1
  104. package/package.json +3 -3
  105. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts +0 -8
  106. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts.map +0 -1
  107. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js +0 -44
  108. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js.map +0 -1
  109. package/lib/cim/components/ClusterDeployment/ArmCheckbox.tsx +0 -101
@@ -48,6 +48,9 @@ import './infra-env.css';
48
48
  import { getErrorMessage } from '../../../common/utils';
49
49
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
50
50
  import { TFunction } from 'i18next';
51
+ import CpuArchitectureDropdown from '../common/CpuArchitectureDropdown';
52
+ import OpenshiftVersionDropdown from './OpenshiftVersionDropdown';
53
+ import { OsImage } from '../../types';
51
54
 
52
55
  export type EnvironmentStepFormValues = {
53
56
  name: string;
@@ -60,9 +63,13 @@ export type EnvironmentStepFormValues = {
60
63
  enableProxy: boolean;
61
64
  labels: string[];
62
65
  networkType: 'dhcp' | 'static';
63
- cpuArchitecture: CpuArchitecture;
66
+ cpuArchitecture: Extract<
67
+ CpuArchitecture,
68
+ CpuArchitecture.x86 | CpuArchitecture.ARM | CpuArchitecture.s390x
69
+ >;
64
70
  enableNtpSources: boolean;
65
71
  additionalNtpSources: string;
72
+ osImageVersion?: string;
66
73
  };
67
74
 
68
75
  const validationSchema = (usedNames: string[], t: TFunction) =>
@@ -112,6 +119,7 @@ const initialValues: EnvironmentStepFormValues = {
112
119
  cpuArchitecture: CpuArchitecture.x86,
113
120
  enableNtpSources: false,
114
121
  additionalNtpSources: '',
122
+ osImageVersion: '',
115
123
  };
116
124
 
117
125
  type InfraEnvFormProps = {
@@ -119,6 +127,7 @@ type InfraEnvFormProps = {
119
127
  pullSecret?: string;
120
128
  sshPublicKey?: string;
121
129
  docVersion: string;
130
+ osImages?: OsImage[];
122
131
  };
123
132
 
124
133
  const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
@@ -127,6 +136,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
127
136
  pullSecret,
128
137
  sshPublicKey,
129
138
  docVersion,
139
+ osImages,
130
140
  }) => {
131
141
  const { values, setFieldValue } = useFormikContext<EnvironmentStepFormValues>();
132
142
  const { t } = useTranslation();
@@ -136,6 +146,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
136
146
  setFieldValue('sshPublicKey', sshPublicKey);
137
147
  // eslint-disable-next-line react-hooks/exhaustive-deps
138
148
  }, [pullSecret, sshPublicKey]);
149
+
139
150
  return (
140
151
  <Stack hasGutter>
141
152
  <StackItem>
@@ -216,27 +227,8 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
216
227
  </FlexItem>
217
228
  </Flex>
218
229
  </FormGroup>
219
- <FormGroup fieldId="cpuArchitecture" label={t('ai:CPU architecture')}>
220
- <Flex justifyContent={{ default: 'justifyContentFlexStart' }}>
221
- <FlexItem>
222
- <RadioField
223
- name="cpuArchitecture"
224
- id="x86_64"
225
- value="x86_64"
226
- label={t('ai:x86_64')}
227
- />
228
- </FlexItem>
229
- <FlexItem spacer={{ default: 'spacer4xl' }} />
230
- <FlexItem>
231
- <RadioField
232
- name="cpuArchitecture"
233
- id="arm64"
234
- value="arm64"
235
- label={<>{t('ai:arm64')}&nbsp;</>}
236
- />
237
- </FlexItem>
238
- </Flex>
239
- </FormGroup>
230
+ <CpuArchitectureDropdown />
231
+ {!!osImages && <OpenshiftVersionDropdown osImages={osImages} />}
240
232
  <RichInputField
241
233
  label={t('ai:Location')}
242
234
  name="location"
@@ -291,6 +283,7 @@ type InfraEnvFormPageProps = InfraEnvFormProps & {
291
283
  pullSecret?: string;
292
284
  sshPublicKey?: string;
293
285
  docVersion: string;
286
+ osImages?: OsImage[];
294
287
  };
295
288
 
296
289
  export const InfraEnvFormPage: React.FC<InfraEnvFormPageProps> = ({
@@ -105,9 +105,7 @@ const InfraTableToolbar: React.FC<InfraTableToolbarProps> = ({
105
105
  <SearchInput
106
106
  placeholder={t('ai:Find by hostname')}
107
107
  value={hostnameFilter}
108
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
109
- // @ts-ignore
110
- onChange={setHostnameFilter}
108
+ onChange={(_e, value) => setHostnameFilter(value)}
111
109
  onClear={() => setHostnameFilter(undefined)}
112
110
  />
113
111
  </ToolbarItem>
@@ -0,0 +1,71 @@
1
+ import * as React from 'react';
2
+ import { Dropdown, DropdownItem, DropdownToggle, FormGroup, Tooltip } from '@patternfly/react-core';
3
+ import { useField } from 'formik';
4
+ import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
5
+ import { architectureData, getFieldId, SupportedCpuArchitecture } from '../../../common';
6
+ import { OsImage } from '../../types';
7
+
8
+ const OpenshiftVersionDropdown = ({ osImages }: { osImages: OsImage[] }) => {
9
+ const { t } = useTranslation();
10
+ const [{ name, value }, , { setValue }] = useField<string>('osImageVersion');
11
+ const [{ value: cpuArchitecture }] = useField<string>('cpuArchitecture');
12
+ const [osImageOpen, setOsImageOpen] = React.useState(false);
13
+ const fieldId = getFieldId(name, 'input');
14
+
15
+ const onOsImageSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
16
+ const val = e?.currentTarget.id || '';
17
+ setValue(val);
18
+ setOsImageOpen(false);
19
+ };
20
+
21
+ const filteredImages = React.useMemo(
22
+ () => osImages.filter((image) => image.cpuArchitecture === cpuArchitecture),
23
+ [osImages, cpuArchitecture],
24
+ );
25
+
26
+ React.useEffect(() => {
27
+ if (filteredImages.length === 0 && value !== '') {
28
+ setValue('');
29
+ }
30
+ }, [filteredImages.length, setValue, t, value]);
31
+
32
+ return (
33
+ <FormGroup isInline fieldId={fieldId} label={t('ai:OpenShift version')}>
34
+ <Tooltip
35
+ content={t(
36
+ 'ai:No OpenShift images available for selected CPU architecture {{cpuArchitecture}}.',
37
+ architectureData[cpuArchitecture as SupportedCpuArchitecture].label,
38
+ )}
39
+ hidden={!!filteredImages.length}
40
+ >
41
+ <Dropdown
42
+ toggle={
43
+ <DropdownToggle
44
+ onToggle={() => setOsImageOpen(!osImageOpen)}
45
+ className="pf-u-w-100"
46
+ isDisabled={!filteredImages.length}
47
+ >
48
+ {value ? `OpenShift ${value}` : t('ai:No version selected')}
49
+ </DropdownToggle>
50
+ }
51
+ name="osImageVersion"
52
+ isOpen={osImageOpen}
53
+ onSelect={onOsImageSelect}
54
+ dropdownItems={[
55
+ <DropdownItem key={'NO_VALUE'} value={''}>
56
+ {t('ai:No version selected')}
57
+ </DropdownItem>,
58
+ ...filteredImages.map((image) => (
59
+ <DropdownItem key={image.openshiftVersion} id={image.openshiftVersion}>
60
+ {`OpenShift ${image.openshiftVersion}`}
61
+ </DropdownItem>
62
+ )),
63
+ ]}
64
+ className="pf-u-w-100"
65
+ />
66
+ </Tooltip>
67
+ </FormGroup>
68
+ );
69
+ };
70
+
71
+ export default OpenshiftVersionDropdown;
@@ -0,0 +1,93 @@
1
+ import * as React from 'react';
2
+ import { Dropdown, DropdownItem, DropdownToggle, FormGroup } from '@patternfly/react-core';
3
+ import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
4
+ import {
5
+ architectureData,
6
+ CpuArchitecture,
7
+ getFieldId,
8
+ StaticField,
9
+ SupportedCpuArchitecture,
10
+ } from '../../../common';
11
+ import { useField } from 'formik';
12
+ import { useFormikHelpers } from '../../../common/hooks/useFormikHelpers';
13
+
14
+ const allDropdownItems = {
15
+ [CpuArchitecture.x86]: (
16
+ <DropdownItem key={'x86_64'} id="x86_64" description={architectureData['x86_64'].description}>
17
+ {architectureData['x86_64'].label}
18
+ </DropdownItem>
19
+ ),
20
+ [CpuArchitecture.ARM]: (
21
+ <DropdownItem key={'arm64'} id="arm64" description={architectureData['arm64'].description}>
22
+ {architectureData['arm64'].label}
23
+ </DropdownItem>
24
+ ),
25
+ [CpuArchitecture.s390x]: (
26
+ <DropdownItem key={'s390x'} id="s390x" description={architectureData['s390x'].description}>
27
+ {architectureData['s390x'].label}
28
+ </DropdownItem>
29
+ ),
30
+ };
31
+
32
+ const CpuArchitectureDropdown = ({
33
+ isDisabled = false,
34
+ cpuArchitectures,
35
+ }: {
36
+ isDisabled?: boolean;
37
+ cpuArchitectures?: string[];
38
+ }) => {
39
+ const { t } = useTranslation();
40
+ const [{ name, value }, , { setValue }] = useField<SupportedCpuArchitecture | ''>(
41
+ 'cpuArchitecture',
42
+ );
43
+ const [cpuArchOpen, setCpuArchOpen] = React.useState(false);
44
+ const fieldId = getFieldId(name, 'input');
45
+ const { setValue: setUserManagedNetworking } = useFormikHelpers<boolean>('userManagedNetworking');
46
+
47
+ const onCpuArchSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
48
+ const val = e?.currentTarget.id as SupportedCpuArchitecture;
49
+ setValue(val);
50
+ setUserManagedNetworking(val === CpuArchitecture.s390x);
51
+
52
+ setCpuArchOpen(false);
53
+ };
54
+
55
+ const dropdownItems = React.useMemo(() => {
56
+ if (!cpuArchitectures) {
57
+ return Object.values(allDropdownItems);
58
+ } else {
59
+ return Object.entries(allDropdownItems)
60
+ .filter(([key, _]) => cpuArchitectures.includes(key))
61
+ .map(([_, val]) => val);
62
+ }
63
+ }, [cpuArchitectures]);
64
+
65
+ React.useEffect(() => {
66
+ if (!isDisabled && value !== '' && cpuArchitectures && !cpuArchitectures?.includes(value)) {
67
+ setValue('');
68
+ }
69
+ }, [cpuArchitectures, isDisabled, setValue, value]);
70
+
71
+ return !isDisabled ? (
72
+ <FormGroup isInline fieldId={fieldId} label={t('ai:CPU architecture')} isRequired>
73
+ <Dropdown
74
+ toggle={
75
+ <DropdownToggle onToggle={() => setCpuArchOpen(!cpuArchOpen)} className="pf-u-w-100">
76
+ {value ? architectureData[value].label : t('ai:CPU architecture')}
77
+ </DropdownToggle>
78
+ }
79
+ name="cpuArchitecture"
80
+ isOpen={cpuArchOpen}
81
+ onSelect={onCpuArchSelect}
82
+ dropdownItems={dropdownItems}
83
+ className="pf-u-w-100"
84
+ />
85
+ </FormGroup>
86
+ ) : (
87
+ <StaticField name={'cpuArchitecture'} label={t('ai:CPU architecture')} isRequired>
88
+ {architectureData[value as SupportedCpuArchitecture].label}
89
+ </StaticField>
90
+ );
91
+ };
92
+
93
+ export default CpuArchitectureDropdown;
@@ -42,6 +42,11 @@ export const bmhStatus = (t: TFunction): HostStatus<string> => ({
42
42
  title: t('ai:Pending'),
43
43
  category: 'Bare Metal Host related',
44
44
  },
45
+ 'externally provisioned': {
46
+ key: 'externally provisioned',
47
+ title: t('ai:Externally provisioned'),
48
+ category: 'Bare Metal Host related',
49
+ },
45
50
  });
46
51
 
47
52
  export const agentStatus = (t: TFunction): HostStatus<string> => ({
@@ -234,5 +234,12 @@ export const getClusterDeploymentCpuArchitecture = (
234
234
  arch = clusterDeployment.metadata?.annotations?.[CPU_ARCHITECTURE_ANNOTATION_KEY];
235
235
  }
236
236
 
237
- return arch === CpuArchitecture.ARM ? CpuArchitecture.ARM : CpuArchitecture.x86;
237
+ switch (arch) {
238
+ case CpuArchitecture.ARM:
239
+ return CpuArchitecture.ARM;
240
+ case CpuArchitecture.s390x:
241
+ return CpuArchitecture.s390x;
242
+ default:
243
+ return CpuArchitecture.x86;
244
+ }
238
245
  };
@@ -4,6 +4,7 @@ import {
4
4
  AgentClusterInstallK8sResource,
5
5
  ClusterImageSetK8sResource,
6
6
  ClusterVersionK8sResource,
7
+ OsImage,
7
8
  } from '../../types';
8
9
  import { OpenshiftVersionOptionType } from '../../../common';
9
10
  import { OpenshiftVersion } from '@openshift-assisted/types/assisted-installer-service';
@@ -51,7 +52,12 @@ export const isValidImageSet = (cis: ClusterImageSetK8sResource, architectures?:
51
52
  export const getOCPVersions = (
52
53
  clusterImageSets: ClusterImageSetK8sResource[],
53
54
  isNutanix?: boolean | undefined,
55
+ osImages?: OsImage[],
54
56
  ): OpenshiftVersionOptionType[] => {
57
+ const ocpImageVersions = Array.from(
58
+ new Set(osImages?.map((osImage) => osImage.openshiftVersion)),
59
+ );
60
+
55
61
  const versions = clusterImageSets
56
62
  .filter((clusterImageSet) =>
57
63
  isValidImageSet(clusterImageSet, isNutanix ? supportedNutanixPlatforms : undefined),
@@ -67,6 +73,10 @@ export const getOCPVersions = (
67
73
  supportLevel: 'production', // getSupportLevelFromChannel(clusterImageSet.metadata?.labels?.channel),
68
74
  };
69
75
  })
76
+ .filter((ocpVersion) => {
77
+ const ver = ocpVersion.version.split('.').slice(0, 2).join('.');
78
+ return !!ocpImageVersions.length ? ocpImageVersions.includes(ver) : true;
79
+ })
70
80
  .sort(
71
81
  (versionA, versionB) => /* descending */ -1 * versionA.label.localeCompare(versionB.label),
72
82
  );
@@ -75,6 +85,7 @@ export const getOCPVersions = (
75
85
  // make sure that the pre-selected one is the first-one after sorting
76
86
  versions[0].default = true;
77
87
  }
88
+
78
89
  const deduped = uniqBy(versions, (v) => v.version);
79
90
  return deduped;
80
91
  };
@@ -86,6 +97,7 @@ export const getSelectedVersion = (
86
97
  const selectedClusterImage = clusterImages.find(
87
98
  (ci) => ci.metadata?.name === agentClusterInstall?.spec?.imageSetRef?.name,
88
99
  );
100
+
89
101
  return selectedClusterImage
90
102
  ? getOCPVersions([selectedClusterImage])?.[0]?.version
91
103
  : agentClusterInstall?.spec?.imageSetRef?.name;
@@ -11,6 +11,13 @@ type StorageConfig = {
11
11
  };
12
12
  };
13
13
 
14
+ export type OsImage = {
15
+ cpuArchitecture: string;
16
+ openshiftVersion: string;
17
+ url: string;
18
+ version: string;
19
+ };
20
+
14
21
  export type AgentServiceConfigConditionType = 'DeploymentsHealthy' | 'ReconcileCompleted';
15
22
 
16
23
  export type AgentServiceConfigK8sResource = K8sResourceCommon & {
@@ -18,6 +25,7 @@ export type AgentServiceConfigK8sResource = K8sResourceCommon & {
18
25
  databaseStorage: StorageConfig;
19
26
  filesystemStorage: StorageConfig;
20
27
  imageStorage: StorageConfig;
28
+ osImages?: OsImage[];
21
29
  };
22
30
  status?: {
23
31
  conditions?: StatusCondition<AgentServiceConfigConditionType>[];
@@ -23,7 +23,8 @@ export type InfraEnvK8sResource = K8sResourceCommon & {
23
23
  };
24
24
  nmStateConfigLabelSelector?: Selector;
25
25
  additionalNTPSources?: string[];
26
- cpuArchitecture?: 'x86_64' | 'arm64';
26
+ cpuArchitecture?: 'x86_64' | 'arm64' | 's390x';
27
+ osImageVersion?: string;
27
28
  };
28
29
  status?: {
29
30
  agentLabelSelector?: Selector;
@@ -76,6 +76,7 @@ export const getClusterDetailsInitialValues = ({
76
76
  diskEncryption: cluster?.diskEncryption ?? {},
77
77
  cpuArchitecture: cluster?.cpuArchitecture || getDefaultCpuArchitecture(),
78
78
  platform: cluster?.platform?.type || 'none',
79
+ userManagedNetworking: cluster?.userManagedNetworking || false,
79
80
  };
80
81
  };
81
82
 
@@ -31,6 +31,7 @@ export type ClusterDetailsValues = {
31
31
  diskEncryption: DiskEncryption;
32
32
  cpuArchitecture: string;
33
33
  platform: PlatformType;
34
+ userManagedNetworking: boolean;
34
35
  };
35
36
 
36
37
  export type HostsValidationsProps<S extends string, V extends string[]> = {
@@ -211,8 +211,10 @@ export const filterByHostname = (hosts: Host[], hostnameFilter: string | undefin
211
211
 
212
212
  const fuse = new Fuse(hostsWithHostname, {
213
213
  ignoreLocation: true,
214
+ threshold: 0.3,
214
215
  keys: ['hostname'],
215
216
  });
217
+
216
218
  return fuse.search(hostnameFilter).map(({ item }) => item.host);
217
219
  };
218
220
 
@@ -6,6 +6,11 @@
6
6
  border: 1px solid transparent;
7
7
  outline: none;
8
8
  width: 100%;
9
+ background-color: initial;
10
+ }
11
+
12
+ .label-field__input::placeholder {
13
+ color: var(--pf-c-form-control--placeholder--Color);
9
14
  }
10
15
 
11
16
  .label-field .react-autosuggest__suggestions-list {
@@ -2,6 +2,12 @@ import { ArchitectureSupportLevelId } from '@openshift-assisted/types/assisted-i
2
2
 
3
3
  export type ClusterCpuArchitecture = 'x86_64' | 'aarch64' | 'arm64' | 'ppc64le' | 's390x' | 'multi';
4
4
 
5
+ export type CpuArchitectureItem = {
6
+ description: string;
7
+ featureSupportLevelId?: ArchitectureSupportLevelId;
8
+ label: string;
9
+ };
10
+
5
11
  export enum CpuArchitecture {
6
12
  x86 = 'x86_64',
7
13
  ARM = 'arm64',
@@ -43,6 +49,28 @@ export const getAllCpuArchitectures = (): SupportedCpuArchitecture[] => [
43
49
  CpuArchitecture.s390x,
44
50
  ];
45
51
 
52
+ export const architectureData: Record<SupportedCpuArchitecture, CpuArchitectureItem> = {
53
+ [CpuArchitecture.x86]: {
54
+ description: '',
55
+ label: 'x86_64',
56
+ },
57
+ [CpuArchitecture.ARM]: {
58
+ description: 'Some features may not be available',
59
+ featureSupportLevelId: 'ARM64_ARCHITECTURE',
60
+ label: 'Arm64',
61
+ },
62
+ [CpuArchitecture.ppc64le]: {
63
+ description: 'Some features may not be available',
64
+ featureSupportLevelId: 'PPC64LE_ARCHITECTURE',
65
+ label: 'IBM Power (ppc64le)',
66
+ },
67
+ [CpuArchitecture.s390x]: {
68
+ description: 'Some features may not be available',
69
+ featureSupportLevelId: 'S390X_ARCHITECTURE',
70
+ label: 'IBM Z (s390x)',
71
+ },
72
+ };
73
+
46
74
  export const getSupportedCpuArchitectures = (
47
75
  cpuArchitectures: CpuArchitecture[],
48
76
  day1CpuArchitecture?: SupportedCpuArchitecture,
@@ -11,17 +11,14 @@ import {
11
11
  import { CaretDownIcon } from '@patternfly/react-icons/dist/js/icons/caret-down-icon';
12
12
  import { useField } from 'formik';
13
13
  import {
14
+ architectureData,
14
15
  CpuArchitecture,
15
16
  FeatureId,
16
17
  getDefaultCpuArchitecture,
17
18
  getFieldId,
18
19
  SupportedCpuArchitecture,
19
20
  } from '../../../common';
20
- import {
21
- ArchitectureSupportLevelId,
22
- Cluster,
23
- PlatformType,
24
- } from '@openshift-assisted/types/assisted-installer-service';
21
+ import { Cluster, PlatformType } from '@openshift-assisted/types/assisted-installer-service';
25
22
  import {
26
23
  NewFeatureSupportLevelMap,
27
24
  useNewFeatureSupportLevel,
@@ -29,34 +26,6 @@ import {
29
26
  import useSupportLevelsAPI from '../../hooks/useSupportLevelsAPI';
30
27
  import { ExternalPlaformIds, ExternalPlatformLabels } from './platformIntegration/constants';
31
28
 
32
- export type CpuArchitectureItem = {
33
- description: string;
34
- featureSupportLevelId?: ArchitectureSupportLevelId;
35
- label: string;
36
- };
37
-
38
- export const architectureData: Record<SupportedCpuArchitecture, CpuArchitectureItem> = {
39
- [CpuArchitecture.x86]: {
40
- description: '',
41
- label: 'x86_64',
42
- },
43
- [CpuArchitecture.ARM]: {
44
- description: 'Some features may not be available',
45
- featureSupportLevelId: 'ARM64_ARCHITECTURE',
46
- label: 'Arm64',
47
- },
48
- [CpuArchitecture.ppc64le]: {
49
- description: 'Some features may not be available',
50
- featureSupportLevelId: 'PPC64LE_ARCHITECTURE',
51
- label: 'IBM Power (ppc64le)',
52
- },
53
- [CpuArchitecture.s390x]: {
54
- description: 'Some features may not be available',
55
- featureSupportLevelId: 'S390X_ARCHITECTURE',
56
- label: 'IBM Z (s390x)',
57
- },
58
- };
59
-
60
29
  const INPUT_NAME = 'cpuArchitecture';
61
30
  const fieldId = getFieldId(INPUT_NAME, 'input');
62
31
 
@@ -14,6 +14,7 @@ import {
14
14
  StaticTextField,
15
15
  getSupportedCpuArchitectures,
16
16
  SupportedCpuArchitecture,
17
+ architectureData,
17
18
  } from '../../../common';
18
19
  import DiskEncryptionControlGroup from '../../../common/components/clusterConfiguration/DiskEncryptionFields/DiskEncryptionControlGroup';
19
20
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
@@ -21,10 +22,7 @@ import { OcmRichInputField } from '../ui/OcmFormFields';
21
22
  import OcmOpenShiftVersion from './OcmOpenShiftVersion';
22
23
  import OcmOpenShiftVersionSelect from './OcmOpenShiftVersionSelect';
23
24
  import CustomManifestCheckbox from './CustomManifestCheckbox';
24
- import CpuArchitectureDropdown, {
25
- architectureData,
26
- CpuArchitectureItem,
27
- } from './CpuArchitectureDropdown';
25
+ import CpuArchitectureDropdown from './CpuArchitectureDropdown';
28
26
  import { OcmBaseDomainField } from './OcmBaseDomainField';
29
27
  import OcmSNOControlGroup from './OcmSNOControlGroup';
30
28
  import useSupportLevelsAPI from '../../hooks/useSupportLevelsAPI';
@@ -80,9 +78,8 @@ export const OcmClusterDetailsFormFields = ({
80
78
  () => getSupportedCpuArchitectures(cpuArchitecturesByVersionImage),
81
79
  [cpuArchitecturesByVersionImage],
82
80
  );
83
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
84
- // @ts-ignore
85
- const cpuArchitecture = (architectureData[values.cpuArchitecture] as CpuArchitectureItem).label;
81
+ const cpuArchitecture =
82
+ architectureData[values.cpuArchitecture as SupportedCpuArchitecture].label;
86
83
 
87
84
  const featureSupportLevelContext = useNewFeatureSupportLevel();
88
85
 
@@ -16,6 +16,7 @@ import {
16
16
  CpuArchitecture,
17
17
  FeatureId,
18
18
  SupportedCpuArchitecture,
19
+ architectureData,
19
20
  getFieldId,
20
21
  } from '../../../../common';
21
22
  import { ExternalPlaformIds, ExternalPlatformLabels, ExternalPlatformLinks } from './constants';
@@ -25,7 +26,6 @@ import {
25
26
  NewFeatureSupportLevelMap,
26
27
  useNewFeatureSupportLevel,
27
28
  } from '../../../../common/components/newFeatureSupportLevels';
28
- import { architectureData } from '../CpuArchitectureDropdown';
29
29
  import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
30
30
 
31
31
  const INPUT_NAME = 'platform';
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ActiveFeatureConfiguration,
3
+ architectureData,
3
4
  CpuArchitecture,
4
5
  FeatureId,
5
6
  isSNO,
6
7
  OperatorsValues,
7
8
  SupportedCpuArchitecture,
8
9
  } from '../../../common';
9
- import { architectureData } from '../clusterConfiguration/CpuArchitectureDropdown';
10
10
  import {
11
11
  Cluster,
12
12
  PlatformType,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.12.0-cim",
4
- "@openshift-assisted/types": "2.12.0-cim",
3
+ "@openshift-assisted/locales": "2.13.0-cim",
4
+ "@openshift-assisted/types": "2.13.0-cim",
5
5
  "@openshift-console/dynamic-plugin-sdk": "0.0.3",
6
6
  "@patternfly/patternfly": "^4.222.4",
7
7
  "@patternfly/react-code-editor": "^4.82.113",
@@ -141,5 +141,5 @@
141
141
  ]
142
142
  }
143
143
  },
144
- "version": "2.12.0-cim"
144
+ "version": "2.13.0-cim"
145
145
  }
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { OpenshiftVersionOptionType } from '../../../common';
3
- type ArmCheckboxProps = {
4
- versions: OpenshiftVersionOptionType[];
5
- };
6
- declare const ArmCheckbox: React.FC<ArmCheckboxProps>;
7
- export default ArmCheckbox;
8
- //# sourceMappingURL=ArmCheckbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArmCheckbox.d.ts","sourceRoot":"","sources":["../../../../../lib/cim/components/ClusterDeployment/ArmCheckbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,0BAA0B,EAE3B,MAAM,iBAAiB,CAAC;AA4BzB,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,0BAA0B,EAAE,CAAA;CAAE,CAAC;AAEnE,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2D3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const React = tslib_1.__importStar(require("react"));
5
- const react_core_1 = require("@patternfly/react-core");
6
- const formik_1 = require("formik");
7
- const common_1 = require("../../../common");
8
- const featureSupportLevels_1 = require("../../../common/components/featureSupportLevels");
9
- const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
10
- const Label = ({ version }) => {
11
- const { t } = (0, use_translation_wrapper_1.useTranslation)();
12
- return (React.createElement(React.Fragment, null,
13
- t('ai:Use arm64 CPU architecture'),
14
- ' ',
15
- React.createElement(common_1.PopoverIcon, { noVerticalAlign: true, bodyContent: React.createElement("p", null, t('ai:Check this option if you want to use the arm64 CPU architecture instead of the default x86_64 CPU architecture. Please note that some features will not be available.')) }),
16
- React.createElement(featureSupportLevels_1.FeatureSupportLevelBadge, { featureId: "ARM64_ARCHITECTURE", openshiftVersion: version })));
17
- };
18
- const ArmCheckbox = ({ versions }) => {
19
- const { t } = (0, use_translation_wrapper_1.useTranslation)();
20
- const { values: { openshiftVersion }, } = (0, formik_1.useFormikContext)();
21
- const [{ name, value }, , { setValue }] = (0, formik_1.useField)('cpuArchitecture');
22
- const fieldId = (0, common_1.getFieldId)(name, 'input');
23
- const featureSupportLevelContext = (0, featureSupportLevels_1.useFeatureSupportLevel)();
24
- const isSupportedVersionAvailable = !!versions.find((version) => featureSupportLevelContext.isFeatureSupported(version.value, 'ARM64_ARCHITECTURE'));
25
- const prevVersionRef = React.useRef(openshiftVersion);
26
- const handleChange = React.useCallback((checked) => setValue(checked ? common_1.CpuArchitecture.ARM : common_1.CpuArchitecture.x86), [setValue]);
27
- React.useEffect(() => {
28
- if (prevVersionRef.current !== openshiftVersion &&
29
- !featureSupportLevelContext.isFeatureSupported(openshiftVersion, 'ARM64_ARCHITECTURE')) {
30
- //invoke updating cpu architecture value only if the version changed to not be in danger of touching existing clusters
31
- handleChange(false);
32
- }
33
- prevVersionRef.current = openshiftVersion;
34
- }, [openshiftVersion, handleChange, featureSupportLevelContext]);
35
- if (!isSupportedVersionAvailable) {
36
- return null;
37
- }
38
- const disabledReason = featureSupportLevelContext.getFeatureDisabledReason(openshiftVersion, 'ARM64_ARCHITECTURE');
39
- return (React.createElement(react_core_1.FormGroup, { isInline: true, fieldId: fieldId },
40
- React.createElement(react_core_1.Tooltip, { hidden: !disabledReason, content: disabledReason },
41
- React.createElement(react_core_1.Checkbox, { id: fieldId, name: name, isDisabled: featureSupportLevelContext.isFeatureDisabled(openshiftVersion, 'ARM64_ARCHITECTURE'), label: React.createElement(Label, { version: openshiftVersion }), "aria-describedby": `${fieldId}-helper`, description: React.createElement(common_1.HelperText, { fieldId: fieldId }, t('ai:Make sure all the hosts are using arm64 CPU architecture.')), isChecked: value === common_1.CpuArchitecture.ARM, onChange: handleChange }))));
42
- };
43
- exports.default = ArmCheckbox;
44
- //# sourceMappingURL=ArmCheckbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArmCheckbox.js","sourceRoot":"","sources":["../../../../../lib/cim/components/ClusterDeployment/ArmCheckbox.tsx"],"names":[],"mappings":"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"}