@openshift-assisted/ui-lib 2.48.3 → 2.48.4

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 (91) hide show
  1. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts +0 -4
  2. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
  3. package/build/@types/common/api/assisted-service/HostsAPI.d.ts +1 -0
  4. package/build/@types/common/api/assisted-service/HostsAPI.d.ts.map +1 -1
  5. package/build/@types/common/components/ui/formik/PullSecretField.d.ts.map +1 -1
  6. package/build/@types/ocm/components/Routes.d.ts.map +1 -1
  7. package/build/@types/ocm/components/clusterWizard/ClusterDetailsForm.d.ts.map +1 -1
  8. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts +0 -3
  9. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts.map +1 -1
  10. package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
  11. package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts +1 -2
  12. package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts.map +1 -1
  13. package/build/@types/ocm/components/clusterWizard/NewClusterWizard.d.ts.map +1 -1
  14. package/build/@types/ocm/components/clusterWizard/constants.d.ts.map +1 -1
  15. package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts.map +1 -1
  16. package/build/@types/ocm/components/clusterWizard/disconnected/InstallDisconnectedSwitch.d.ts.map +1 -1
  17. package/build/@types/ocm/components/clusterWizard/disconnected/ReviewStep.d.ts.map +1 -1
  18. package/build/@types/ocm/components/clusterWizard/index.d.ts +0 -1
  19. package/build/@types/ocm/components/clusterWizard/index.d.ts.map +1 -1
  20. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts +1 -1
  21. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts.map +1 -1
  22. package/build/@types/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.d.ts +1 -1
  23. package/build/@types/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.d.ts.map +1 -1
  24. package/build/@types/ocm/services/ClustersService.d.ts +0 -4
  25. package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
  26. package/build/@types/ocm/services/HostsService.d.ts +1 -0
  27. package/build/@types/ocm/services/HostsService.d.ts.map +1 -1
  28. package/build/cjs/common/api/assisted-service/ClustersAPI.js +0 -3
  29. package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
  30. package/build/cjs/common/api/assisted-service/HostsAPI.js +3 -0
  31. package/build/cjs/common/api/assisted-service/HostsAPI.js.map +1 -1
  32. package/build/cjs/common/components/ui/WizardFooter.js +1 -1
  33. package/build/cjs/common/components/ui/WizardFooter.js.map +1 -1
  34. package/build/cjs/common/components/ui/formik/PullSecretField.js.map +1 -1
  35. package/build/cjs/ocm/components/Routes.js +1 -2
  36. package/build/cjs/ocm/components/Routes.js.map +1 -1
  37. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js +5 -4
  38. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js.map +1 -1
  39. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContext.js.map +1 -1
  40. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +0 -4
  41. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
  42. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js +6 -21
  43. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js.map +1 -1
  44. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js +0 -3
  45. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js.map +1 -1
  46. package/build/cjs/ocm/components/clusterWizard/constants.js +0 -1
  47. package/build/cjs/ocm/components/clusterWizard/constants.js.map +1 -1
  48. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js +8 -51
  49. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js.map +1 -1
  50. package/build/cjs/ocm/components/clusterWizard/disconnected/InstallDisconnectedSwitch.js +1 -1
  51. package/build/cjs/ocm/components/clusterWizard/disconnected/InstallDisconnectedSwitch.js.map +1 -1
  52. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js +8 -43
  53. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js.map +1 -1
  54. package/build/cjs/ocm/components/clusterWizard/index.js +1 -3
  55. package/build/cjs/ocm/components/clusterWizard/index.js.map +1 -1
  56. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js +0 -3
  57. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js.map +1 -1
  58. package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js +1 -1
  59. package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js.map +1 -1
  60. package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js +4 -14
  61. package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js.map +1 -1
  62. package/build/cjs/ocm/services/ClustersService.js +0 -6
  63. package/build/cjs/ocm/services/ClustersService.js.map +1 -1
  64. package/build/cjs/ocm/services/HostsService.js +6 -0
  65. package/build/cjs/ocm/services/HostsService.js.map +1 -1
  66. package/lib/common/api/assisted-service/ClustersAPI.ts +0 -6
  67. package/lib/common/api/assisted-service/HostsAPI.ts +5 -0
  68. package/lib/common/components/ui/WizardFooter.tsx +1 -1
  69. package/lib/common/components/ui/formik/PullSecretField.tsx +0 -1
  70. package/lib/ocm/components/Routes.tsx +1 -3
  71. package/lib/ocm/components/clusterWizard/ClusterDetailsForm.tsx +10 -9
  72. package/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx +0 -3
  73. package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +0 -6
  74. package/lib/ocm/components/clusterWizard/ClusterWizardFooter.tsx +5 -26
  75. package/lib/ocm/components/clusterWizard/NewClusterWizard.tsx +0 -3
  76. package/lib/ocm/components/clusterWizard/constants.ts +0 -1
  77. package/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx +13 -63
  78. package/lib/ocm/components/clusterWizard/disconnected/InstallDisconnectedSwitch.tsx +1 -0
  79. package/lib/ocm/components/clusterWizard/disconnected/ReviewStep.tsx +11 -43
  80. package/lib/ocm/components/clusterWizard/index.ts +0 -1
  81. package/lib/ocm/components/clusterWizard/wizardTransition.ts +1 -5
  82. package/lib/ocm/components/clusters/AssistedInstallerHeader.tsx +2 -2
  83. package/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx +4 -23
  84. package/lib/ocm/services/ClustersService.ts +0 -6
  85. package/lib/ocm/services/HostsService.ts +8 -0
  86. package/package.json +3 -3
  87. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts +0 -4
  88. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map +0 -1
  89. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js +0 -128
  90. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map +0 -1
  91. package/lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx +0 -201
@@ -1,201 +0,0 @@
1
- import * as React from 'react';
2
- import { Formik, useFormikContext } from 'formik';
3
- import * as Yup from 'yup';
4
- import {
5
- ClusterWizardStep,
6
- TechnologyPreview,
7
- getRichTextValidation,
8
- sshPublicKeyValidationSchema,
9
- pullSecretValidationSchema,
10
- getFormikErrorFields,
11
- } from '../../../../common';
12
- import { Split, SplitItem, Grid, GridItem, Form, Content, Checkbox } from '@patternfly/react-core';
13
- import { useClusterWizardContext } from '../ClusterWizardContext';
14
- import ClusterWizardFooter from '../ClusterWizardFooter';
15
- import ClusterWizardNavigation from '../ClusterWizardNavigation';
16
- import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
17
- import UploadSSH from '../../../../common/components/clusterConfiguration/UploadSSH';
18
- import PullSecretField from '../../../../common/components/ui/formik/PullSecretField';
19
- import { isInOcm, handleApiError, getApiErrorMessage } from '../../../../common/api';
20
- import { useAlerts } from '../../../../common/components/AlertsContextProvider';
21
- import { AlertVariant } from '@patternfly/react-core';
22
- import InfraEnvsService from '../../../services/InfraEnvsService';
23
- import { InfraEnvsAPI } from '../../../services/apis';
24
- import usePullSecret from '../../../hooks/usePullSecret';
25
- import { useParams } from 'react-router-dom-v5-compat';
26
- import ClustersService from '../../../services/ClustersService';
27
- import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
28
-
29
- type OptionalConfigurationsFormValues = {
30
- sshPublicKey?: string;
31
- pullSecret?: string;
32
- };
33
-
34
- const PullSecretSync: React.FC<{ pullSecret?: string }> = ({ pullSecret }) => {
35
- const { setFieldValue } = useFormikContext<OptionalConfigurationsFormValues>();
36
-
37
- React.useEffect(() => {
38
- if (pullSecret !== undefined) {
39
- setFieldValue('pullSecret', pullSecret);
40
- }
41
- }, [pullSecret, setFieldValue]);
42
-
43
- return null;
44
- };
45
-
46
- const OptionalConfigurationsStep = () => {
47
- const pullSecret = usePullSecret() || '';
48
- const { clusterId } = useParams<{ clusterId: string }>();
49
- const [cluster, setCluster] = React.useState<Cluster | null>(null);
50
-
51
- const { moveNext, moveBack, setDisconnectedInfraEnv, disconnectedInfraEnv } =
52
- useClusterWizardContext();
53
- const { addAlert } = useAlerts();
54
- const [editPullSecret, setEditPullSecret] = React.useState(false);
55
-
56
- React.useEffect(() => {
57
- const fetchCluster = async () => {
58
- if (!clusterId) {
59
- return;
60
- }
61
- try {
62
- const fetchedCluster = await ClustersService.get(clusterId);
63
- setCluster(fetchedCluster);
64
- } catch (error) {
65
- handleApiError(error, () => {
66
- addAlert({
67
- title: 'Failed to fetch cluster',
68
- message: getApiErrorMessage(error),
69
- variant: AlertVariant.danger,
70
- });
71
- });
72
- }
73
- };
74
- void fetchCluster();
75
- }, [clusterId, addAlert]);
76
-
77
- const validationSchema = React.useMemo(
78
- () =>
79
- Yup.object<OptionalConfigurationsFormValues>().shape({
80
- sshPublicKey: sshPublicKeyValidationSchema,
81
- pullSecret: pullSecretValidationSchema,
82
- }),
83
- [],
84
- );
85
-
86
- const initialValues: OptionalConfigurationsFormValues = {
87
- sshPublicKey: '',
88
- pullSecret: pullSecret,
89
- };
90
-
91
- return (
92
- <Formik
93
- initialValues={initialValues}
94
- validate={getRichTextValidation<OptionalConfigurationsFormValues>(validationSchema)}
95
- onSubmit={async (values) => {
96
- if (!cluster || !cluster.id) {
97
- addAlert({
98
- title: 'Missing cluster',
99
- message: 'Cluster must be created before configuring infrastructure environment',
100
- variant: AlertVariant.danger,
101
- });
102
- return;
103
- }
104
-
105
- try {
106
- // Check if infraEnv already exists
107
- if (disconnectedInfraEnv && disconnectedInfraEnv.id) {
108
- // Update existing infraEnv
109
- const updateParams = {
110
- pullSecret: values.pullSecret || pullSecret,
111
- ...(values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }),
112
- };
113
- const { data: updatedInfraEnv } = await InfraEnvsAPI.update(
114
- disconnectedInfraEnv.id,
115
- updateParams,
116
- );
117
- setDisconnectedInfraEnv(updatedInfraEnv);
118
- moveNext();
119
- } else {
120
- // Create infraEnv with all params
121
- const createParams = {
122
- name: `disconnected-cluster_infra-env`,
123
- pullSecret: values.pullSecret || pullSecret,
124
- clusterId: cluster.id,
125
- openshiftVersion: cluster.openshiftVersion,
126
- cpuArchitecture: 'x86_64' as const,
127
- ...(values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }),
128
- };
129
- const createdInfraEnv = await InfraEnvsService.create(createParams);
130
- setDisconnectedInfraEnv(createdInfraEnv);
131
- moveNext();
132
- }
133
- } catch (error) {
134
- handleApiError(error, () => {
135
- addAlert({
136
- title:
137
- disconnectedInfraEnv && disconnectedInfraEnv.id
138
- ? 'Failed to update infrastructure environment'
139
- : 'Failed to create infrastructure environment',
140
- message: getApiErrorMessage(error),
141
- variant: AlertVariant.danger,
142
- });
143
- });
144
- }
145
- }}
146
- >
147
- {({ submitForm, isValid, errors, touched, isSubmitting }) => {
148
- const errorFields = getFormikErrorFields(errors, touched);
149
- const handleNext = () => {
150
- void submitForm(); // This will trigger onSubmit
151
- };
152
-
153
- return (
154
- <ClusterWizardStep
155
- navigation={<ClusterWizardNavigation />}
156
- footer={
157
- <ClusterWizardFooter
158
- disconnectedClusterId={clusterId}
159
- onNext={handleNext} // Changed from moveNext
160
- onBack={moveBack}
161
- isNextDisabled={!isValid}
162
- errorFields={errorFields}
163
- isSubmitting={isSubmitting}
164
- />
165
- }
166
- >
167
- <WithErrorBoundary title="Failed to load Optional Configurations step">
168
- <PullSecretSync pullSecret={pullSecret} />
169
- <Grid hasGutter>
170
- <GridItem>
171
- <Split>
172
- <SplitItem>
173
- <Content component="h2">Optional configurations</Content>
174
- </SplitItem>
175
- <SplitItem>
176
- <TechnologyPreview />
177
- </SplitItem>
178
- </Split>
179
- </GridItem>
180
- <GridItem>
181
- <Form id="wizard-cluster-optional-configurations__form">
182
- <UploadSSH />
183
- <Checkbox
184
- label="Edit pull secret"
185
- isChecked={editPullSecret}
186
- onChange={(_, checked) => setEditPullSecret(checked)}
187
- id="edit-pull-secret-checkbox"
188
- />
189
- {(editPullSecret || !pullSecret) && <PullSecretField isOcm={isInOcm} />}
190
- </Form>
191
- </GridItem>
192
- </Grid>
193
- </WithErrorBoundary>
194
- </ClusterWizardStep>
195
- );
196
- }}
197
- </Formik>
198
- );
199
- };
200
-
201
- export default OptionalConfigurationsStep;