@openshift-assisted/ui-lib 2.55.0 → 2.55.2

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 (61) hide show
  1. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts +2 -1
  2. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
  3. package/build/@types/common/components/ui/formik/PullSecretField.d.ts +1 -0
  4. package/build/@types/common/components/ui/formik/PullSecretField.d.ts.map +1 -1
  5. package/build/@types/common/config/docs_links.d.ts +1 -0
  6. package/build/@types/common/config/docs_links.d.ts.map +1 -1
  7. package/build/@types/common/types/clusters.d.ts +1 -1
  8. package/build/@types/common/types/clusters.d.ts.map +1 -1
  9. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts +5 -0
  10. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts.map +1 -1
  11. package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
  12. package/build/@types/ocm/components/clusterWizard/NewClusterWizard.d.ts.map +1 -1
  13. package/build/@types/ocm/components/clusterWizard/constants.d.ts.map +1 -1
  14. package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts +1 -0
  15. package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts.map +1 -1
  16. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts +4 -0
  17. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map +1 -0
  18. package/build/@types/ocm/components/clusterWizard/disconnected/ReviewStep.d.ts.map +1 -1
  19. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts +1 -1
  20. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts.map +1 -1
  21. package/build/@types/ocm/services/ClustersService.d.ts +2 -1
  22. package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
  23. package/build/cjs/common/api/assisted-service/ClustersAPI.js +3 -0
  24. package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
  25. package/build/cjs/common/components/ui/formik/PullSecretField.js +2 -2
  26. package/build/cjs/common/components/ui/formik/PullSecretField.js.map +1 -1
  27. package/build/cjs/common/config/docs_links.js +3 -1
  28. package/build/cjs/common/config/docs_links.js.map +1 -1
  29. package/build/cjs/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.js.map +1 -1
  30. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContext.js.map +1 -1
  31. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +9 -0
  32. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
  33. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js +3 -0
  34. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js.map +1 -1
  35. package/build/cjs/ocm/components/clusterWizard/constants.js +1 -0
  36. package/build/cjs/ocm/components/clusterWizard/constants.js.map +1 -1
  37. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js +16 -22
  38. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js.map +1 -1
  39. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js +102 -0
  40. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map +1 -0
  41. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js +50 -49
  42. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js.map +1 -1
  43. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js +3 -0
  44. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js.map +1 -1
  45. package/build/cjs/ocm/services/ClustersService.js +3 -0
  46. package/build/cjs/ocm/services/ClustersService.js.map +1 -1
  47. package/lib/common/api/assisted-service/ClustersAPI.ts +8 -0
  48. package/lib/common/components/ui/formik/PullSecretField.tsx +5 -2
  49. package/lib/common/config/docs_links.ts +3 -0
  50. package/lib/common/types/clusters.ts +1 -1
  51. package/lib/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.tsx +2 -2
  52. package/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx +5 -0
  53. package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +9 -0
  54. package/lib/ocm/components/clusterWizard/NewClusterWizard.tsx +3 -0
  55. package/lib/ocm/components/clusterWizard/constants.ts +1 -0
  56. package/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx +31 -52
  57. package/lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx +173 -0
  58. package/lib/ocm/components/clusterWizard/disconnected/ReviewStep.tsx +90 -91
  59. package/lib/ocm/components/clusterWizard/wizardTransition.ts +4 -0
  60. package/lib/ocm/services/ClustersService.ts +5 -0
  61. package/package.json +3 -3
@@ -0,0 +1,173 @@
1
+ import * as React from 'react';
2
+ import { Formik, useFormikContext } from 'formik';
3
+ import * as Yup from 'yup';
4
+ import { AlertVariant } from '@patternfly/react-core';
5
+ import { Form, Grid, GridItem, Content } from '@patternfly/react-core';
6
+ import {
7
+ ClusterWizardStep,
8
+ PullSecret,
9
+ UploadSSH,
10
+ handleApiError,
11
+ getApiErrorMessage,
12
+ isInOcm,
13
+ pullSecretValidationSchema,
14
+ sshPublicKeyValidationSchema,
15
+ useAlerts,
16
+ useTranslation,
17
+ } from '../../../../common';
18
+ import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
19
+ import { useClusterWizardContext } from '../ClusterWizardContext';
20
+ import ClusterWizardFooter from '../ClusterWizardFooter';
21
+ import ClusterWizardNavigation from '../ClusterWizardNavigation';
22
+ import { InfraEnvsAPI, ClustersAPI } from '../../../services/apis';
23
+ import { ImageType } from '@openshift-assisted/types/assisted-installer-service';
24
+ import usePullSecret from '../../../hooks/usePullSecret';
25
+ import { DISCONNECTED_OPENSHIFT_VERSION } from './BasicStep';
26
+
27
+ const DISCONNECTED_IMAGE_TYPE: ImageType = 'disconnected-iso';
28
+ const DISCONNECTED_CLUSTER_NAME = 'disconnected-cluster';
29
+
30
+ type OptionalConfigurationsValues = {
31
+ sshPublicKey: string;
32
+ pullSecret: string;
33
+ };
34
+
35
+ type OptionalConfigurationsFormProps = {
36
+ defaultPullSecret?: string;
37
+ isSubmitting: boolean;
38
+ };
39
+
40
+ const OptionalConfigurationsForm: React.FC<OptionalConfigurationsFormProps> = ({
41
+ defaultPullSecret,
42
+ isSubmitting,
43
+ }) => {
44
+ const { moveBack } = useClusterWizardContext();
45
+ const { isValid, submitForm } = useFormikContext<OptionalConfigurationsValues>();
46
+
47
+ return (
48
+ <ClusterWizardStep
49
+ navigation={<ClusterWizardNavigation />}
50
+ footer={
51
+ <ClusterWizardFooter
52
+ onNext={() => void submitForm()}
53
+ onBack={moveBack}
54
+ isSubmitting={isSubmitting}
55
+ isNextDisabled={!isValid}
56
+ />
57
+ }
58
+ >
59
+ <WithErrorBoundary title="Failed to load Optional configurations step">
60
+ <Grid hasGutter>
61
+ <GridItem>
62
+ <Content component="h2">Optional configurations</Content>
63
+ </GridItem>
64
+ <GridItem>
65
+ <Form id="wizard-cluster-optional-config__form">
66
+ <UploadSSH />
67
+ {!isInOcm && <PullSecret isOcm={false} defaultPullSecret={defaultPullSecret} />}
68
+ </Form>
69
+ </GridItem>
70
+ </Grid>
71
+ </WithErrorBoundary>
72
+ </ClusterWizardStep>
73
+ );
74
+ };
75
+
76
+ const OptionalConfigurationsStep = () => {
77
+ const { t } = useTranslation();
78
+ const {
79
+ moveNext,
80
+ disconnectedCluster,
81
+ setDisconnectedCluster,
82
+ disconnectedInfraEnv,
83
+ setDisconnectedInfraEnv,
84
+ } = useClusterWizardContext();
85
+ const { addAlert, clearAlerts } = useAlerts();
86
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
87
+ const defaultPullSecret = usePullSecret();
88
+
89
+ const validationSchema = React.useMemo(
90
+ () =>
91
+ Yup.object({
92
+ sshPublicKey: sshPublicKeyValidationSchema(t),
93
+ pullSecret: isInOcm ? Yup.string() : pullSecretValidationSchema(t),
94
+ }),
95
+ [t],
96
+ );
97
+
98
+ const initialValues: OptionalConfigurationsValues = {
99
+ sshPublicKey: disconnectedInfraEnv?.sshAuthorizedKey ?? '',
100
+ pullSecret: defaultPullSecret ?? '',
101
+ };
102
+
103
+ const handleNext = React.useCallback(
104
+ async (values: OptionalConfigurationsValues) => {
105
+ clearAlerts();
106
+ setIsSubmitting(true);
107
+ try {
108
+ const pullSecretToUse = isInOcm ? defaultPullSecret ?? '' : values.pullSecret;
109
+
110
+ if (disconnectedCluster?.id && disconnectedInfraEnv?.id) {
111
+ const { data: updatedInfraEnv } = await InfraEnvsAPI.update(disconnectedInfraEnv.id, {
112
+ sshAuthorizedKey: values.sshPublicKey,
113
+ });
114
+ setDisconnectedInfraEnv(updatedInfraEnv);
115
+ } else {
116
+ const { data: cluster } = await ClustersAPI.registerDisconnected({
117
+ name: DISCONNECTED_CLUSTER_NAME,
118
+ openshiftVersion: DISCONNECTED_OPENSHIFT_VERSION,
119
+ });
120
+ setDisconnectedCluster(cluster);
121
+
122
+ const { data: createdInfraEnv } = await InfraEnvsAPI.register({
123
+ name: 'disconnected-infra-env',
124
+ pullSecret: pullSecretToUse,
125
+ clusterId: cluster.id,
126
+ imageType: DISCONNECTED_IMAGE_TYPE,
127
+ openshiftVersion: DISCONNECTED_OPENSHIFT_VERSION,
128
+ sshAuthorizedKey: values.sshPublicKey || undefined,
129
+ });
130
+ setDisconnectedInfraEnv(createdInfraEnv);
131
+ }
132
+
133
+ moveNext();
134
+ } catch (error) {
135
+ handleApiError(error, () => {
136
+ addAlert({
137
+ title: 'Failed to save optional configurations',
138
+ message: getApiErrorMessage(error),
139
+ variant: AlertVariant.danger,
140
+ });
141
+ });
142
+ } finally {
143
+ setIsSubmitting(false);
144
+ }
145
+ },
146
+ [
147
+ clearAlerts,
148
+ defaultPullSecret,
149
+ disconnectedCluster,
150
+ disconnectedInfraEnv,
151
+ setDisconnectedCluster,
152
+ setDisconnectedInfraEnv,
153
+ addAlert,
154
+ moveNext,
155
+ ],
156
+ );
157
+
158
+ return (
159
+ <Formik<OptionalConfigurationsValues>
160
+ initialValues={initialValues}
161
+ enableReinitialize
162
+ validationSchema={validationSchema}
163
+ onSubmit={(values) => void handleNext(values)}
164
+ >
165
+ <OptionalConfigurationsForm
166
+ defaultPullSecret={defaultPullSecret}
167
+ isSubmitting={isSubmitting}
168
+ />
169
+ </Formik>
170
+ );
171
+ };
172
+
173
+ export default OptionalConfigurationsStep;
@@ -1,14 +1,6 @@
1
1
  import * as React from 'react';
2
- import ClusterWizardFooter from '../ClusterWizardFooter';
3
- import { useClusterWizardContext } from '../ClusterWizardContext';
4
- import {
5
- ClusterWizardStep,
6
- TechnologyPreview,
7
- PULL_SECRET_INFO_LINK,
8
- singleClusterOperators,
9
- } from '../../../../common';
10
- import ClusterWizardNavigation from '../ClusterWizardNavigation';
11
- import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
2
+ import { saveAs } from 'file-saver';
3
+ import { useNavigate } from 'react-router';
12
4
  import {
13
5
  Split,
14
6
  SplitItem,
@@ -24,95 +16,102 @@ import {
24
16
  OrderType,
25
17
  Content,
26
18
  } from '@patternfly/react-core';
27
- import { Formik } from 'formik';
28
- import { saveAs } from 'file-saver';
29
- import { useNavigate } from 'react-router';
30
-
19
+ import {
20
+ ClusterWizardStep,
21
+ TechnologyPreview,
22
+ ExternalLink,
23
+ getDisconnectedDocsLink,
24
+ getMajorMinorVersion,
25
+ PULL_SECRET_INFO_LINK,
26
+ singleClusterOperators,
27
+ } from '../../../../common';
28
+ import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
31
29
  import { getOperatorSpecs } from '../../../../common/components/operators/operatorSpecs';
32
-
33
- const downloadUrl =
34
- 'https://mirror.openshift.com/pub/cgw/assisted-installer-disconnected/latest/agent-ove.x86_64.iso';
30
+ import { useClusterWizardContext } from '../ClusterWizardContext';
31
+ import { DISCONNECTED_OPENSHIFT_VERSION } from './BasicStep';
32
+ import ClusterWizardFooter from '../ClusterWizardFooter';
33
+ import ClusterWizardNavigation from '../ClusterWizardNavigation';
35
34
 
36
35
  const ReviewStep = () => {
37
- const { moveBack } = useClusterWizardContext();
36
+ const { moveBack, disconnectedInfraEnv } = useClusterWizardContext();
38
37
  const opSpecs = getOperatorSpecs(() => undefined);
39
38
  const navigate = useNavigate();
40
39
 
41
40
  return (
42
- <Formik
43
- initialValues={{}}
44
- onSubmit={() => {
45
- // nothing to do
46
- }}
41
+ <ClusterWizardStep
42
+ navigation={<ClusterWizardNavigation />}
43
+ footer={
44
+ <ClusterWizardFooter
45
+ onNext={() => {
46
+ saveAs(disconnectedInfraEnv?.downloadUrl ?? '');
47
+ void navigate('/cluster-list');
48
+ }}
49
+ onBack={moveBack}
50
+ nextButtonText="Download ISO"
51
+ />
52
+ }
47
53
  >
48
- <ClusterWizardStep
49
- navigation={<ClusterWizardNavigation />}
50
- footer={
51
- <ClusterWizardFooter
52
- onNext={() => {
53
- downloadUrl && saveAs(downloadUrl);
54
- void navigate('/cluster-list');
55
- }}
56
- onBack={moveBack}
57
- nextButtonText="Download ISO"
58
- />
59
- }
60
- >
61
- <WithErrorBoundary title="Failed to load Review step">
62
- <Grid hasGutter>
63
- <Split>
64
- <SplitItem>
65
- <Content component="h2">Review and download ISO</Content>
66
- </SplitItem>
67
- <SplitItem>
68
- <TechnologyPreview />
69
- </SplitItem>
70
- </Split>
71
- <Alert isInline variant="info" title="Discovery ISO boot instructions">
72
- <List component={ListComponent.ol} type={OrderType.number}>
73
- <ListItem>Download ISO</ListItem>
74
- <ListItem>
75
- Download or copy your pull secret from{' '}
76
- <a href={PULL_SECRET_INFO_LINK} target="_blank" rel="noopener noreferrer">
77
- here
78
- </a>
79
- </ListItem>
80
- <ListItem>
81
- Boot your cluster's machines from this ISO and follow instructions
82
- </ListItem>
83
- <ListItem>
84
- Provide your pull secret inside the installation wizard when requested
85
- </ListItem>
86
- </List>
87
- </Alert>
88
- <Alert isInline isExpandable variant="info" title="List of available operators">
89
- <List>
90
- {singleClusterOperators.map((o) => {
91
- const operator = Object.values(opSpecs)
92
- .flatMap((op) => op)
93
- .find((op) => op.operatorKey === o);
94
- return <ListItem key={o}>{operator ? operator.title : o}</ListItem>;
95
- })}
96
- </List>
97
- </Alert>
98
- <DescriptionList isHorizontal>
99
- <DescriptionListGroup>
100
- <DescriptionListTerm>OpenShift version</DescriptionListTerm>
101
- <DescriptionListDescription>4.20</DescriptionListDescription>
102
- </DescriptionListGroup>
103
- <DescriptionListGroup>
104
- <DescriptionListTerm>CPU architecture</DescriptionListTerm>
105
- <DescriptionListDescription>x86_64</DescriptionListDescription>
106
- </DescriptionListGroup>
107
- <DescriptionListGroup>
108
- <DescriptionListTerm>ISO size</DescriptionListTerm>
109
- <DescriptionListDescription>approx. 43.5GB</DescriptionListDescription>
110
- </DescriptionListGroup>
111
- </DescriptionList>
112
- </Grid>
113
- </WithErrorBoundary>
114
- </ClusterWizardStep>
115
- </Formik>
54
+ <WithErrorBoundary title="Failed to load Review step">
55
+ <Grid hasGutter>
56
+ <Split>
57
+ <SplitItem>
58
+ <Content component="h2">Review and download ISO</Content>
59
+ </SplitItem>
60
+ <SplitItem>
61
+ <TechnologyPreview />
62
+ </SplitItem>
63
+ </Split>
64
+ <Alert isInline variant="info" title="ISO boot instructions">
65
+ <List component={ListComponent.ol} type={OrderType.number}>
66
+ <ListItem>Download the ISO.</ListItem>
67
+ <ListItem>
68
+ Boot your cluster's machines from this ISO and{' '}
69
+ <ExternalLink
70
+ href={getDisconnectedDocsLink(
71
+ getMajorMinorVersion(DISCONNECTED_OPENSHIFT_VERSION),
72
+ )}
73
+ >
74
+ follow instructions
75
+ </ExternalLink>
76
+ .
77
+ </ListItem>
78
+ <ListItem>
79
+ Your <ExternalLink href={PULL_SECRET_INFO_LINK}>pull secret</ExternalLink> was
80
+ included automatically. You can change it inside the installation wizard.
81
+ </ListItem>
82
+ </List>
83
+ </Alert>
84
+ <Alert isInline isExpandable variant="info" title="List of available operators">
85
+ <List>
86
+ {singleClusterOperators.map((o) => {
87
+ const operator = Object.values(opSpecs)
88
+ .flatMap((op) => op)
89
+ .find((op) => op.operatorKey === o);
90
+ return <ListItem key={o}>{operator ? operator.title : o}</ListItem>;
91
+ })}
92
+ </List>
93
+ </Alert>
94
+ <DescriptionList isHorizontal>
95
+ <DescriptionListGroup>
96
+ <DescriptionListTerm>OpenShift version</DescriptionListTerm>
97
+ <DescriptionListDescription>
98
+ {disconnectedInfraEnv?.openshiftVersion ?? DISCONNECTED_OPENSHIFT_VERSION}
99
+ </DescriptionListDescription>
100
+ </DescriptionListGroup>
101
+ <DescriptionListGroup>
102
+ <DescriptionListTerm>CPU architecture</DescriptionListTerm>
103
+ <DescriptionListDescription>
104
+ {disconnectedInfraEnv?.cpuArchitecture ?? 'x86_64'}
105
+ </DescriptionListDescription>
106
+ </DescriptionListGroup>
107
+ <DescriptionListGroup>
108
+ <DescriptionListTerm>ISO size</DescriptionListTerm>
109
+ <DescriptionListDescription>approx. 50+GB</DescriptionListDescription>
110
+ </DescriptionListGroup>
111
+ </DescriptionList>
112
+ </Grid>
113
+ </WithErrorBoundary>
114
+ </ClusterWizardStep>
116
115
  );
117
116
  };
118
117
 
@@ -34,6 +34,7 @@ export type ClusterWizardStepsType =
34
34
  | 'custom-manifests'
35
35
  | 'credentials-download'
36
36
  | 'disconnected-basic'
37
+ | 'disconnected-optional-configurations'
37
38
  | 'disconnected-review';
38
39
 
39
40
  const wizardStepsOrder: ClusterWizardStepsType[] = [
@@ -52,6 +53,7 @@ const wizardStepsOrder: ClusterWizardStepsType[] = [
52
53
 
53
54
  export const disconnectedSteps: ClusterWizardStepsType[] = [
54
55
  'disconnected-basic',
56
+ 'disconnected-optional-configurations',
55
57
  'disconnected-review',
56
58
  ];
57
59
 
@@ -323,6 +325,7 @@ const credentialsValidationMap = buildEmptyValidationsMap();
323
325
 
324
326
  const disconnectedReviewValidationsMap = buildEmptyValidationsMap();
325
327
  const disconnectedBasicValidationsMap = buildEmptyValidationsMap();
328
+ const disconnectedOptionalConfigurationsValidationsMap = buildEmptyValidationsMap();
326
329
 
327
330
  export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardStepsType> = {
328
331
  'cluster-details': clusterDetailsStepValidationsMap,
@@ -338,6 +341,7 @@ export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardSt
338
341
  review: reviewStepValidationsMap,
339
342
  'disconnected-review': disconnectedReviewValidationsMap,
340
343
  'disconnected-basic': disconnectedBasicValidationsMap,
344
+ 'disconnected-optional-configurations': disconnectedOptionalConfigurationsValidationsMap,
341
345
  };
342
346
 
343
347
  export const allClusterWizardSoftValidationIds =
@@ -5,6 +5,7 @@ import type {
5
5
  } from '../components/clusterConfiguration/manifestsConfiguration/data/dataTypes';
6
6
  import type {
7
7
  Cluster,
8
+ DisconnectedClusterCreateParams,
8
9
  Host,
9
10
  InfraEnvCreateParams,
10
11
  UpdateManifestParams,
@@ -122,6 +123,10 @@ const ClustersService = {
122
123
  return cluster;
123
124
  },
124
125
 
126
+ registerDisconnected(params: DisconnectedClusterCreateParams) {
127
+ return ClustersAPI.registerDisconnected(params);
128
+ },
129
+
125
130
  transformFormViewManifest(manifest: CustomManifestValues) {
126
131
  return {
127
132
  folder: manifest.folder,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.55.0",
4
- "@openshift-assisted/types": "2.55.0",
3
+ "@openshift-assisted/locales": "2.55.2",
4
+ "@openshift-assisted/types": "2.55.2",
5
5
  "@openshift-console/dynamic-plugin-sdk": "^4.22.0",
6
6
  "@patternfly/patternfly": "6.4.0",
7
7
  "@patternfly/react-code-editor": "6.4.1",
@@ -136,5 +136,5 @@
136
136
  ]
137
137
  }
138
138
  },
139
- "version": "2.55.0"
139
+ "version": "2.55.2"
140
140
  }