@openshift-assisted/ui-lib 2.12.1-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 (53) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts +2 -0
  2. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts.map +1 -1
  3. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts +2 -1
  4. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
  5. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts +3 -5
  6. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts.map +1 -1
  7. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts +1 -0
  8. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  9. package/build/@types/cim/components/InfraEnv/EnvironmentDetails.d.ts.map +1 -1
  10. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +4 -0
  11. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
  12. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts +6 -0
  13. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts.map +1 -0
  14. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +2 -1
  15. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -1
  16. package/build/@types/cim/components/helpers/versions.d.ts +2 -2
  17. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  18. package/build/@types/cim/types/k8s/agent-service-config.d.ts +7 -0
  19. package/build/@types/cim/types/k8s/agent-service-config.d.ts.map +1 -1
  20. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +1 -0
  21. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
  22. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js +7 -6
  23. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js.map +1 -1
  24. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +19 -4
  25. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
  26. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js +4 -5
  27. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js.map +1 -1
  28. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +2 -2
  29. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  30. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js +10 -7
  31. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js.map +1 -1
  32. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +4 -1
  33. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  34. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js +34 -0
  35. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js.map +1 -0
  36. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +23 -7
  37. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -1
  38. package/build/cjs/cim/components/helpers/versions.js +6 -1
  39. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  40. package/build/cjs/common/components/ui/formik/LabelField.css +5 -0
  41. package/lib/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.tsx +17 -3
  42. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +30 -4
  43. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.tsx +9 -9
  44. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +3 -2
  45. package/lib/cim/components/InfraEnv/EnvironmentDetails.tsx +10 -0
  46. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +8 -0
  47. package/lib/cim/components/InfraEnv/OpenshiftVersionDropdown.tsx +71 -0
  48. package/lib/cim/components/common/CpuArchitectureDropdown.tsx +47 -27
  49. package/lib/cim/components/helpers/versions.ts +12 -0
  50. package/lib/cim/types/k8s/agent-service-config.ts +8 -0
  51. package/lib/cim/types/k8s/infra-env-k8s-resource.ts +1 -0
  52. package/lib/common/components/ui/formik/LabelField.css +5 -0
  53. package/package.json +3 -3
@@ -11,9 +11,35 @@ import {
11
11
  import { useField } from 'formik';
12
12
  import { useFormikHelpers } from '../../../common/hooks/useFormikHelpers';
13
13
 
14
- const CpuArchitectureDropdown = ({ isDisabled = false }: { isDisabled?: boolean }) => {
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
+ }) => {
15
39
  const { t } = useTranslation();
16
- const [{ name, value }, , { setValue }] = useField<SupportedCpuArchitecture>('cpuArchitecture');
40
+ const [{ name, value }, , { setValue }] = useField<SupportedCpuArchitecture | ''>(
41
+ 'cpuArchitecture',
42
+ );
17
43
  const [cpuArchOpen, setCpuArchOpen] = React.useState(false);
18
44
  const fieldId = getFieldId(name, 'input');
19
45
  const { setValue: setUserManagedNetworking } = useFormikHelpers<boolean>('userManagedNetworking');
@@ -26,8 +52,24 @@ const CpuArchitectureDropdown = ({ isDisabled = false }: { isDisabled?: boolean
26
52
  setCpuArchOpen(false);
27
53
  };
28
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
+
29
71
  return !isDisabled ? (
30
- <FormGroup isInline fieldId={fieldId} label={t('ai:CPU architecture')} required>
72
+ <FormGroup isInline fieldId={fieldId} label={t('ai:CPU architecture')} isRequired>
31
73
  <Dropdown
32
74
  toggle={
33
75
  <DropdownToggle onToggle={() => setCpuArchOpen(!cpuArchOpen)} className="pf-u-w-100">
@@ -37,35 +79,13 @@ const CpuArchitectureDropdown = ({ isDisabled = false }: { isDisabled?: boolean
37
79
  name="cpuArchitecture"
38
80
  isOpen={cpuArchOpen}
39
81
  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
- ]}
82
+ dropdownItems={dropdownItems}
63
83
  className="pf-u-w-100"
64
84
  />
65
85
  </FormGroup>
66
86
  ) : (
67
87
  <StaticField name={'cpuArchitecture'} label={t('ai:CPU architecture')} isRequired>
68
- {architectureData[value].label}
88
+ {architectureData[value as SupportedCpuArchitecture].label}
69
89
  </StaticField>
70
90
  );
71
91
  };
@@ -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>[];
@@ -24,6 +24,7 @@ export type InfraEnvK8sResource = K8sResourceCommon & {
24
24
  nmStateConfigLabelSelector?: Selector;
25
25
  additionalNTPSources?: string[];
26
26
  cpuArchitecture?: 'x86_64' | 'arm64' | 's390x';
27
+ osImageVersion?: string;
27
28
  };
28
29
  status?: {
29
30
  agentLabelSelector?: Selector;
@@ -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 {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.12.1-cim",
4
- "@openshift-assisted/types": "2.12.1-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.1-cim"
144
+ "version": "2.13.0-cim"
145
145
  }