@openshift-assisted/ui-lib 2.12.0-cim → 2.12.2-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 (82) hide show
  1. package/build/@types/cim/components/Agent/NoAgentsAlert.d.ts.map +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  3. package/build/@types/cim/components/InfraEnv/EnvironmentDetails.d.ts.map +1 -1
  4. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +1 -1
  5. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
  6. package/build/@types/cim/components/InfraEnv/InfraTableToolbar.d.ts.map +1 -1
  7. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +5 -0
  8. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -0
  9. package/build/@types/cim/components/helpers/agentStatus.d.ts.map +1 -1
  10. package/build/@types/cim/components/helpers/clusterDeployment.d.ts +1 -1
  11. package/build/@types/cim/components/helpers/clusterDeployment.d.ts.map +1 -1
  12. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +1 -1
  13. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
  14. package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
  15. package/build/@types/common/components/clusterWizard/types.d.ts +1 -0
  16. package/build/@types/common/components/clusterWizard/types.d.ts.map +1 -1
  17. package/build/@types/common/components/hosts/utils.d.ts.map +1 -1
  18. package/build/@types/common/components/ui/formik/validationSchemas.d.ts.map +1 -1
  19. package/build/@types/common/types/cpuArchitecture.d.ts +6 -0
  20. package/build/@types/common/types/cpuArchitecture.d.ts.map +1 -1
  21. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts +1 -7
  22. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts.map +1 -1
  23. package/build/@types/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.d.ts.map +1 -1
  24. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.d.ts.map +1 -1
  25. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  26. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +1 -1
  27. package/build/cjs/cim/components/Agent/NoAgentsAlert.js +10 -5
  28. package/build/cjs/cim/components/Agent/NoAgentsAlert.js.map +1 -1
  29. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +2 -2
  30. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  31. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js +2 -1
  32. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js.map +1 -1
  33. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +2 -9
  34. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  35. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js +1 -4
  36. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js.map +1 -1
  37. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +30 -0
  38. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -0
  39. package/build/cjs/cim/components/helpers/agentStatus.js +5 -0
  40. package/build/cjs/cim/components/helpers/agentStatus.js.map +1 -1
  41. package/build/cjs/cim/components/helpers/clusterDeployment.js +8 -1
  42. package/build/cjs/cim/components/helpers/clusterDeployment.js.map +1 -1
  43. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +1 -0
  44. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
  45. package/build/cjs/common/components/hosts/utils.js +1 -0
  46. package/build/cjs/common/components/hosts/utils.js.map +1 -1
  47. package/build/cjs/common/components/ui/formik/validationSchemas.js +12 -6
  48. package/build/cjs/common/components/ui/formik/validationSchemas.js.map +1 -1
  49. package/build/cjs/common/types/cpuArchitecture.js +22 -1
  50. package/build/cjs/common/types/cpuArchitecture.js.map +1 -1
  51. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js +5 -27
  52. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js.map +1 -1
  53. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js +2 -4
  54. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js.map +1 -1
  55. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js +1 -2
  56. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js.map +1 -1
  57. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +1 -2
  58. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  59. package/lib/cim/components/Agent/NoAgentsAlert.tsx +8 -4
  60. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +3 -2
  61. package/lib/cim/components/InfraEnv/EnvironmentDetails.tsx +8 -2
  62. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +7 -22
  63. package/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +1 -3
  64. package/lib/cim/components/common/CpuArchitectureDropdown.tsx +73 -0
  65. package/lib/cim/components/helpers/agentStatus.tsx +5 -0
  66. package/lib/cim/components/helpers/clusterDeployment.ts +8 -1
  67. package/lib/cim/types/k8s/infra-env-k8s-resource.ts +1 -1
  68. package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +1 -0
  69. package/lib/common/components/clusterWizard/types.ts +1 -0
  70. package/lib/common/components/hosts/utils.ts +2 -0
  71. package/lib/common/components/ui/formik/validationSchemas.ts +12 -9
  72. package/lib/common/types/cpuArchitecture.ts +28 -0
  73. package/lib/ocm/components/clusterConfiguration/CpuArchitectureDropdown.tsx +2 -33
  74. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +4 -7
  75. package/lib/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.tsx +1 -1
  76. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +1 -1
  77. package/package.json +4 -3
  78. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts +0 -8
  79. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts.map +0 -1
  80. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js +0 -44
  81. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js.map +0 -1
  82. package/lib/cim/components/ClusterDeployment/ArmCheckbox.tsx +0 -101
@@ -20,7 +20,12 @@ import { PencilAltIcon } from '@patternfly/react-icons/dist/js/icons/pencil-alt-
20
20
  import { global_palette_green_500 as okColor } from '@patternfly/react-tokens/dist/js/global_palette_green_500';
21
21
  import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
22
22
 
23
- import { CpuArchitecture, LabelValue } from '../../../common';
23
+ import {
24
+ architectureData,
25
+ CpuArchitecture,
26
+ LabelValue,
27
+ SupportedCpuArchitecture,
28
+ } from '../../../common';
24
29
  import { InfraEnvK8sResource, SecretK8sResource } from '../../types';
25
30
  import { AGENT_LOCATION_LABEL_KEY } from '../common';
26
31
  import EditPullSecretModal, { EditPullSecretModalProps } from '../modals/EditPullSecretModal';
@@ -160,7 +165,8 @@ const EnvironmentDetails: React.FC<EnvironmentDetailsProps> = ({
160
165
  <DescriptionListGroup>
161
166
  <DescriptionListTerm>{t('ai:CPU architecture')}</DescriptionListTerm>
162
167
  <DescriptionListDescription>
163
- {infraEnv.spec?.cpuArchitecture ?? CpuArchitecture.x86}
168
+ {architectureData[infraEnv.spec?.cpuArchitecture as SupportedCpuArchitecture]
169
+ .label ?? CpuArchitecture.x86}
164
170
  </DescriptionListDescription>
165
171
  </DescriptionListGroup>
166
172
  <DescriptionListGroup>
@@ -48,6 +48,7 @@ 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';
51
52
 
52
53
  export type EnvironmentStepFormValues = {
53
54
  name: string;
@@ -60,7 +61,10 @@ export type EnvironmentStepFormValues = {
60
61
  enableProxy: boolean;
61
62
  labels: string[];
62
63
  networkType: 'dhcp' | 'static';
63
- cpuArchitecture: CpuArchitecture;
64
+ cpuArchitecture: Extract<
65
+ CpuArchitecture,
66
+ CpuArchitecture.x86 | CpuArchitecture.ARM | CpuArchitecture.s390x
67
+ >;
64
68
  enableNtpSources: boolean;
65
69
  additionalNtpSources: string;
66
70
  };
@@ -136,6 +140,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
136
140
  setFieldValue('sshPublicKey', sshPublicKey);
137
141
  // eslint-disable-next-line react-hooks/exhaustive-deps
138
142
  }, [pullSecret, sshPublicKey]);
143
+
139
144
  return (
140
145
  <Stack hasGutter>
141
146
  <StackItem>
@@ -216,27 +221,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
216
221
  </FlexItem>
217
222
  </Flex>
218
223
  </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>
224
+ <CpuArchitectureDropdown />
240
225
  <RichInputField
241
226
  label={t('ai:Location')}
242
227
  name="location"
@@ -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,73 @@
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 CpuArchitectureDropdown = ({ isDisabled = false }: { isDisabled?: boolean }) => {
15
+ const { t } = useTranslation();
16
+ const [{ name, value }, , { setValue }] = useField<SupportedCpuArchitecture>('cpuArchitecture');
17
+ const [cpuArchOpen, setCpuArchOpen] = React.useState(false);
18
+ const fieldId = getFieldId(name, 'input');
19
+ const { setValue: setUserManagedNetworking } = useFormikHelpers<boolean>('userManagedNetworking');
20
+
21
+ const onCpuArchSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
22
+ const val = e?.currentTarget.id as SupportedCpuArchitecture;
23
+ setValue(val);
24
+ setUserManagedNetworking(val === CpuArchitecture.s390x);
25
+
26
+ setCpuArchOpen(false);
27
+ };
28
+
29
+ return !isDisabled ? (
30
+ <FormGroup isInline fieldId={fieldId} label={t('ai:CPU architecture')} required>
31
+ <Dropdown
32
+ toggle={
33
+ <DropdownToggle onToggle={() => setCpuArchOpen(!cpuArchOpen)} className="pf-u-w-100">
34
+ {value ? architectureData[value].label : t('ai:CPU architecture')}
35
+ </DropdownToggle>
36
+ }
37
+ name="cpuArchitecture"
38
+ isOpen={cpuArchOpen}
39
+ onSelect={onCpuArchSelect}
40
+ dropdownItems={[
41
+ <DropdownItem
42
+ key={'x86_64'}
43
+ id="x86_64"
44
+ description={architectureData['x86_64'].description}
45
+ >
46
+ {architectureData['x86_64'].label}
47
+ </DropdownItem>,
48
+ <DropdownItem
49
+ key={'arm64'}
50
+ id="arm64"
51
+ description={architectureData['arm64'].description}
52
+ >
53
+ {architectureData['arm64'].label}
54
+ </DropdownItem>,
55
+ <DropdownItem
56
+ key={'s390x'}
57
+ id="s390x"
58
+ description={architectureData['s390x'].description}
59
+ >
60
+ {architectureData['s390x'].label}
61
+ </DropdownItem>,
62
+ ]}
63
+ className="pf-u-w-100"
64
+ />
65
+ </FormGroup>
66
+ ) : (
67
+ <StaticField name={'cpuArchitecture'} label={t('ai:CPU architecture')} isRequired>
68
+ {architectureData[value].label}
69
+ </StaticField>
70
+ );
71
+ };
72
+
73
+ 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
  };
@@ -23,7 +23,7 @@ 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
27
  };
28
28
  status?: {
29
29
  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
 
@@ -3,6 +3,8 @@ import { Address4, Address6 } from 'ip-address';
3
3
  import isCIDR from 'is-cidr';
4
4
  import { isInSubnet } from 'is-in-subnet';
5
5
  import * as Yup from 'yup';
6
+ import { head } from 'lodash-es';
7
+ import parseUrl from 'parse-url';
6
8
 
7
9
  import { TFunction } from 'i18next';
8
10
  import {
@@ -28,7 +30,6 @@ import {
28
30
  } from './constants';
29
31
  import { allSubnetsIPv4, getAddress, trimCommaSeparatedList, trimSshPublicKey } from './utils';
30
32
  import { selectApiVip, selectIngressVip } from '../../../selectors';
31
- import { head } from 'lodash-es';
32
33
 
33
34
  const ALPHANUMERIC_REGEX = /^[a-zA-Z0-9]+$/;
34
35
  const NAME_START_END_REGEX = /^[a-z0-9](.*[a-z0-9])?$/;
@@ -45,10 +46,6 @@ const IP_V4_ZERO = '0.0.0.0';
45
46
  const IP_V6_ZERO = '0000:0000:0000:0000:0000:0000:0000:0000';
46
47
  const MAC_REGEX = /^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$/;
47
48
  const HOST_NAME_REGEX = /^[^.]{1,63}(?:[.][^.]{1,63})*$/;
48
-
49
- // Source of information: https://github.com/metal3-io/baremetal-operator/blob/main/docs/api.md#baremetalhost-spec
50
- const BMC_REGEX =
51
- /^((redfish-virtualmedia|idrac-virtualmedia)(\+https?)?:(\/\/([a-z0-9\-._~%!$&'()*+,;=]+@)?([a-z0-9\-._~%]+|\[[a-f0-9:.]+\]|\[v[a-f0-9][a-z0-9\-._~%!$&'()*+,;=:]+\])(:[0-9]+)?(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)*\/?|(\/?[a-z0-9\-._~%!$&'()*+,;=:@]+(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)*\/?)?)|([a-z0-9\-._~%!$&'()*+,;=@]+(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)*\/?|(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)+\/?))(\?[a-z0-9\-._~%!$&'()*+,;=:@/?]*)?(#[a-z0-9\-._~%!$&'()*+,;=:@/?]*)?$/i;
52
49
  const LOCATION_CHARS_REGEX = /^[a-zA-Z0-9-._]*$/;
53
50
 
54
51
  export const nameValidationSchema = (
@@ -645,10 +642,16 @@ export const day2ApiVipValidationSchema = Yup.string().test(
645
642
  export const bmcAddressValidationSchema = (t: TFunction) => {
646
643
  const bmcAddressValidationMessagesList = bmcAddressValidationMessages(t);
647
644
 
648
- return Yup.string().required().matches(BMC_REGEX, {
649
- message: bmcAddressValidationMessagesList.INVALID_VALUE,
650
- excludeEmptyString: true,
651
- });
645
+ return Yup.string()
646
+ .required()
647
+ .test('valid-bmc-address', bmcAddressValidationMessagesList.INVALID_VALUE, (val: string) => {
648
+ try {
649
+ const url = parseUrl(val);
650
+ return ['redfish-virtualmedia', 'idrac-virtualmedia'].includes(url.protocol as string);
651
+ } catch (error) {
652
+ return false;
653
+ }
654
+ });
652
655
  };
653
656
  export const locationValidationSchema = (t: TFunction) => {
654
657
  const locationValidationMessagesList = locationValidationMessages(t);
@@ -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.12.2-cim",
4
+ "@openshift-assisted/types": "2.12.2-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",
@@ -25,6 +25,7 @@
25
25
  "is-in-subnet": "^4",
26
26
  "js-yaml": "^4.1.0",
27
27
  "lodash-es": "^4.17.21",
28
+ "parse-url": "^9.2.0",
28
29
  "prism-react-renderer": "^1.1.1",
29
30
  "react-error-boundary": "^3.1.4",
30
31
  "react-measure": "^2.5.2",
@@ -141,5 +142,5 @@
141
142
  ]
142
143
  }
143
144
  },
144
- "version": "2.12.0-cim"
145
+ "version": "2.12.2-cim"
145
146
  }
@@ -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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"}
@@ -1,101 +0,0 @@
1
- import * as React from 'react';
2
- import { Checkbox, FormGroup, Tooltip } from '@patternfly/react-core';
3
- import { useField, useFormikContext } from 'formik';
4
- import {
5
- CpuArchitecture,
6
- getFieldId,
7
- HelperText,
8
- OpenshiftVersionOptionType,
9
- PopoverIcon,
10
- } from '../../../common';
11
- import {
12
- FeatureSupportLevelBadge,
13
- useFeatureSupportLevel,
14
- } from '../../../common/components/featureSupportLevels';
15
- import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
16
- import { ClusterCreateParams } from '@openshift-assisted/types/assisted-installer-service';
17
-
18
- const Label = ({ version }: { version: string }) => {
19
- const { t } = useTranslation();
20
- return (
21
- <>
22
- {t('ai:Use arm64 CPU architecture')}{' '}
23
- <PopoverIcon
24
- noVerticalAlign
25
- bodyContent={
26
- <p>
27
- {t(
28
- '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.',
29
- )}
30
- </p>
31
- }
32
- />
33
- <FeatureSupportLevelBadge featureId="ARM64_ARCHITECTURE" openshiftVersion={version} />
34
- </>
35
- );
36
- };
37
-
38
- type ArmCheckboxProps = { versions: OpenshiftVersionOptionType[] };
39
-
40
- const ArmCheckbox: React.FC<ArmCheckboxProps> = ({ versions }) => {
41
- const { t } = useTranslation();
42
- const {
43
- values: { openshiftVersion },
44
- } = useFormikContext<ClusterCreateParams>();
45
- const [{ name, value }, , { setValue }] = useField<CpuArchitecture>('cpuArchitecture');
46
- const fieldId = getFieldId(name, 'input');
47
-
48
- const featureSupportLevelContext = useFeatureSupportLevel();
49
- const isSupportedVersionAvailable = !!versions.find((version) =>
50
- featureSupportLevelContext.isFeatureSupported(version.value, 'ARM64_ARCHITECTURE'),
51
- );
52
-
53
- const prevVersionRef = React.useRef(openshiftVersion);
54
- const handleChange = React.useCallback(
55
- (checked: boolean) => setValue(checked ? CpuArchitecture.ARM : CpuArchitecture.x86),
56
- [setValue],
57
- );
58
-
59
- React.useEffect(() => {
60
- if (
61
- prevVersionRef.current !== openshiftVersion &&
62
- !featureSupportLevelContext.isFeatureSupported(openshiftVersion, 'ARM64_ARCHITECTURE')
63
- ) {
64
- //invoke updating cpu architecture value only if the version changed to not be in danger of touching existing clusters
65
- handleChange(false);
66
- }
67
- prevVersionRef.current = openshiftVersion;
68
- }, [openshiftVersion, handleChange, featureSupportLevelContext]);
69
- if (!isSupportedVersionAvailable) {
70
- return null;
71
- }
72
- const disabledReason = featureSupportLevelContext.getFeatureDisabledReason(
73
- openshiftVersion,
74
- 'ARM64_ARCHITECTURE',
75
- );
76
- return (
77
- <FormGroup isInline fieldId={fieldId}>
78
- <Tooltip hidden={!disabledReason} content={disabledReason}>
79
- <Checkbox
80
- id={fieldId}
81
- name={name}
82
- isDisabled={featureSupportLevelContext.isFeatureDisabled(
83
- openshiftVersion,
84
- 'ARM64_ARCHITECTURE',
85
- )}
86
- label={<Label version={openshiftVersion} />}
87
- aria-describedby={`${fieldId}-helper`}
88
- description={
89
- <HelperText fieldId={fieldId}>
90
- {t('ai:Make sure all the hosts are using arm64 CPU architecture.')}
91
- </HelperText>
92
- }
93
- isChecked={value === CpuArchitecture.ARM}
94
- onChange={handleChange}
95
- />
96
- </Tooltip>
97
- </FormGroup>
98
- );
99
- };
100
-
101
- export default ArmCheckbox;