@openshift-assisted/ui-lib 2.48.3 → 2.48.5
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.
- package/build/@types/common/api/assisted-service/ClustersAPI.d.ts +0 -4
- package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
- package/build/@types/common/api/assisted-service/HostsAPI.d.ts +1 -0
- package/build/@types/common/api/assisted-service/HostsAPI.d.ts.map +1 -1
- package/build/@types/common/components/ui/formik/PullSecretField.d.ts.map +1 -1
- package/build/@types/ocm/components/Routes.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts +0 -3
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts +1 -2
- package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/NewClusterWizard.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/constants.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/disconnected/ReviewStep.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/index.d.ts +0 -1
- package/build/@types/ocm/components/clusterWizard/index.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts +1 -1
- package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts.map +1 -1
- package/build/@types/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.d.ts +1 -1
- package/build/@types/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.d.ts.map +1 -1
- package/build/@types/ocm/services/ClustersService.d.ts +0 -4
- package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
- package/build/@types/ocm/services/HostsService.d.ts +1 -0
- package/build/@types/ocm/services/HostsService.d.ts.map +1 -1
- package/build/cjs/common/api/assisted-service/ClustersAPI.js +0 -3
- package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
- package/build/cjs/common/api/assisted-service/HostsAPI.js +3 -0
- package/build/cjs/common/api/assisted-service/HostsAPI.js.map +1 -1
- package/build/cjs/common/components/ui/WizardFooter.js +1 -1
- package/build/cjs/common/components/ui/WizardFooter.js.map +1 -1
- package/build/cjs/common/components/ui/formik/PullSecretField.js.map +1 -1
- package/build/cjs/ocm/components/Routes.js +1 -2
- package/build/cjs/ocm/components/Routes.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContext.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +0 -4
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js +6 -21
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js +0 -3
- package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/constants.js +0 -1
- package/build/cjs/ocm/components/clusterWizard/constants.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js +2 -47
- package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js +5 -40
- package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/index.js +1 -3
- package/build/cjs/ocm/components/clusterWizard/index.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/wizardTransition.js +0 -3
- package/build/cjs/ocm/components/clusterWizard/wizardTransition.js.map +1 -1
- package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js +1 -1
- package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js.map +1 -1
- package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js +4 -14
- package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js.map +1 -1
- package/build/cjs/ocm/services/ClustersService.js +0 -6
- package/build/cjs/ocm/services/ClustersService.js.map +1 -1
- package/build/cjs/ocm/services/HostsService.js +6 -0
- package/build/cjs/ocm/services/HostsService.js.map +1 -1
- package/lib/common/api/assisted-service/ClustersAPI.ts +0 -6
- package/lib/common/api/assisted-service/HostsAPI.ts +5 -0
- package/lib/common/components/ui/WizardFooter.tsx +1 -1
- package/lib/common/components/ui/formik/PullSecretField.tsx +0 -1
- package/lib/ocm/components/Routes.tsx +1 -3
- package/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx +0 -3
- package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +0 -6
- package/lib/ocm/components/clusterWizard/ClusterWizardFooter.tsx +5 -26
- package/lib/ocm/components/clusterWizard/NewClusterWizard.tsx +0 -3
- package/lib/ocm/components/clusterWizard/constants.ts +0 -1
- package/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx +3 -56
- package/lib/ocm/components/clusterWizard/disconnected/ReviewStep.tsx +8 -40
- package/lib/ocm/components/clusterWizard/index.ts +0 -1
- package/lib/ocm/components/clusterWizard/wizardTransition.ts +1 -5
- package/lib/ocm/components/clusters/AssistedInstallerHeader.tsx +2 -2
- package/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx +4 -23
- package/lib/ocm/services/ClustersService.ts +0 -6
- package/lib/ocm/services/HostsService.ts +8 -0
- package/package.json +3 -3
- package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts +0 -4
- package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map +0 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js +0 -128
- package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map +0 -1
- package/lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx +0 -201
|
@@ -3,9 +3,9 @@ import ClusterWizardFooter from '../ClusterWizardFooter';
|
|
|
3
3
|
import { useClusterWizardContext } from '../ClusterWizardContext';
|
|
4
4
|
import {
|
|
5
5
|
ClusterWizardStep,
|
|
6
|
-
TechnologyPreview,
|
|
7
6
|
PULL_SECRET_INFO_LINK,
|
|
8
7
|
singleClusterOperators,
|
|
8
|
+
TechnologyPreview,
|
|
9
9
|
} from '../../../../common';
|
|
10
10
|
import ClusterWizardNavigation from '../ClusterWizardNavigation';
|
|
11
11
|
import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
|
|
@@ -26,18 +26,15 @@ import {
|
|
|
26
26
|
} from '@patternfly/react-core';
|
|
27
27
|
import { Formik } from 'formik';
|
|
28
28
|
import { saveAs } from 'file-saver';
|
|
29
|
-
import { useNavigate
|
|
29
|
+
import { useNavigate } from 'react-router-dom-v5-compat';
|
|
30
30
|
|
|
31
31
|
import { getOperatorSpecs } from '../../../../common/components/operators/operatorSpecs';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
import { AlertVariant } from '@patternfly/react-core';
|
|
32
|
+
|
|
33
|
+
const downloadUrl =
|
|
34
|
+
'https://mirror.openshift.com/pub/cgw/assisted-installer-disconnected/4.20.8/agent-ove.x86_64.iso';
|
|
36
35
|
|
|
37
36
|
const ReviewStep = () => {
|
|
38
|
-
const { moveBack
|
|
39
|
-
const { clusterId } = useParams<{ clusterId: string }>();
|
|
40
|
-
const { addAlert } = useAlerts();
|
|
37
|
+
const { moveBack } = useClusterWizardContext();
|
|
41
38
|
const opSpecs = getOperatorSpecs(() => undefined);
|
|
42
39
|
const navigate = useNavigate();
|
|
43
40
|
|
|
@@ -53,40 +50,11 @@ const ReviewStep = () => {
|
|
|
53
50
|
footer={
|
|
54
51
|
<ClusterWizardFooter
|
|
55
52
|
onNext={() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
saveAs(disconnectedInfraEnv.downloadUrl);
|
|
59
|
-
}
|
|
60
|
-
if (clusterId) {
|
|
61
|
-
try {
|
|
62
|
-
await ClustersService.remove(clusterId);
|
|
63
|
-
// Remove infraEnv from wizard context after successful deregistration
|
|
64
|
-
setDisconnectedInfraEnv(undefined);
|
|
65
|
-
// Navigate to cluster-list only after successful deregistration
|
|
66
|
-
navigate('/cluster-list');
|
|
67
|
-
} catch (error) {
|
|
68
|
-
handleApiError(error, () => {
|
|
69
|
-
addAlert({
|
|
70
|
-
title: 'Failed to deregister cluster',
|
|
71
|
-
message: getApiErrorMessage(error),
|
|
72
|
-
variant: AlertVariant.danger,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
// Error handling: continue with navigation even if deregistration fails
|
|
76
|
-
// Still clear the context to avoid stale data
|
|
77
|
-
setDisconnectedInfraEnv(undefined);
|
|
78
|
-
// Navigate even on error to avoid getting stuck
|
|
79
|
-
navigate('/cluster-list');
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
// If there's no cluster to deregister, navigate immediately
|
|
83
|
-
navigate('/cluster-list');
|
|
84
|
-
}
|
|
85
|
-
})();
|
|
53
|
+
downloadUrl && saveAs(downloadUrl);
|
|
54
|
+
navigate('/cluster-list');
|
|
86
55
|
}}
|
|
87
56
|
onBack={moveBack}
|
|
88
57
|
nextButtonText="Download ISO"
|
|
89
|
-
disconnectedClusterId={clusterId}
|
|
90
58
|
/>
|
|
91
59
|
}
|
|
92
60
|
>
|
|
@@ -2,5 +2,4 @@ export { default as ClusterDetailsForm } from './ClusterDetailsForm';
|
|
|
2
2
|
export { default as NewClusterWizard } from './NewClusterWizard';
|
|
3
3
|
export { default as ClusterWizard } from './ClusterWizard';
|
|
4
4
|
export { default as ClusterWizardContextProvider } from './ClusterWizardContextProvider';
|
|
5
|
-
export { useClusterWizardContext } from './ClusterWizardContext';
|
|
6
5
|
export { OpenShiftVersionsContextProvider } from './OpenShiftVersionsContext';
|
|
@@ -31,8 +31,7 @@ export type ClusterWizardStepsType =
|
|
|
31
31
|
| 'custom-manifests'
|
|
32
32
|
| 'credentials-download'
|
|
33
33
|
| 'disconnected-basic'
|
|
34
|
-
| 'disconnected-review'
|
|
35
|
-
| 'disconnected-optional-configurations';
|
|
34
|
+
| 'disconnected-review';
|
|
36
35
|
|
|
37
36
|
const wizardStepsOrder: ClusterWizardStepsType[] = [
|
|
38
37
|
'cluster-details',
|
|
@@ -50,7 +49,6 @@ const wizardStepsOrder: ClusterWizardStepsType[] = [
|
|
|
50
49
|
|
|
51
50
|
export const disconnectedSteps: ClusterWizardStepsType[] = [
|
|
52
51
|
'disconnected-basic',
|
|
53
|
-
'disconnected-optional-configurations',
|
|
54
52
|
'disconnected-review',
|
|
55
53
|
];
|
|
56
54
|
|
|
@@ -262,7 +260,6 @@ const credentialsValidationMap = buildEmptyValidationsMap();
|
|
|
262
260
|
const customManifestsValidationsMap = buildEmptyValidationsMap();
|
|
263
261
|
const disconnectedReviewValidationsMap = buildEmptyValidationsMap();
|
|
264
262
|
const disconnectedBasicValidationsMap = buildEmptyValidationsMap();
|
|
265
|
-
const disconnectedOptionalConfigurationsValidationsMap = buildEmptyValidationsMap();
|
|
266
263
|
|
|
267
264
|
export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardStepsType> = {
|
|
268
265
|
'cluster-details': clusterDetailsStepValidationsMap,
|
|
@@ -278,7 +275,6 @@ export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardSt
|
|
|
278
275
|
'credentials-download': credentialsValidationMap,
|
|
279
276
|
'disconnected-review': disconnectedReviewValidationsMap,
|
|
280
277
|
'disconnected-basic': disconnectedBasicValidationsMap,
|
|
281
|
-
'disconnected-optional-configurations': disconnectedOptionalConfigurationsValidationsMap,
|
|
282
278
|
};
|
|
283
279
|
|
|
284
280
|
export const allClusterWizardSoftValidationIds =
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Content, Split, SplitItem } from '@patternfly/react-core';
|
|
3
3
|
import {
|
|
4
4
|
ASSISTED_INSTALLER_DOCUMENTATION_LINK,
|
|
5
|
-
|
|
5
|
+
DeveloperPreview,
|
|
6
6
|
ExternalLink,
|
|
7
7
|
isInOcm,
|
|
8
8
|
} from '../../../common';
|
|
@@ -15,7 +15,7 @@ export const AssistedInstallerHeader = () => {
|
|
|
15
15
|
<Content component="h1" className="pf-v6-u-display-inline">
|
|
16
16
|
Install OpenShift with the Assisted Installer
|
|
17
17
|
</Content>
|
|
18
|
-
{isSingleClusterFeatureEnabled && <
|
|
18
|
+
{isSingleClusterFeatureEnabled && <DeveloperPreview />}
|
|
19
19
|
<Split hasGutter>
|
|
20
20
|
<SplitItem>
|
|
21
21
|
<ExternalLink href={ASSISTED_INSTALLER_DOCUMENTATION_LINK}>
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
NewFeatureSupportLevelData,
|
|
24
24
|
useNewFeatureSupportLevel,
|
|
25
25
|
} from '../../../common/components/newFeatureSupportLevels';
|
|
26
|
-
import { useFeature } from '../../hooks/use-feature';
|
|
27
26
|
|
|
28
27
|
const getFeatureReviewText = (featureId: FeatureId): string => {
|
|
29
28
|
switch (featureId) {
|
|
@@ -128,7 +127,6 @@ export const getSupportLevelInfo = (
|
|
|
128
127
|
featureSupportLevelData: NewFeatureSupportLevelData,
|
|
129
128
|
isSupportedOpenShiftVersion: (version?: string) => boolean,
|
|
130
129
|
t: TFunction,
|
|
131
|
-
isSingleClusterFeatureEnabled?: boolean,
|
|
132
130
|
) => {
|
|
133
131
|
const limitedClusterFeatures = getLimitedFeatureSupportLevels(
|
|
134
132
|
cluster,
|
|
@@ -139,10 +137,7 @@ export const getSupportLevelInfo = (
|
|
|
139
137
|
return {
|
|
140
138
|
limitedClusterFeatures,
|
|
141
139
|
hasSupportedVersion,
|
|
142
|
-
isFullySupported:
|
|
143
|
-
hasSupportedVersion &&
|
|
144
|
-
Object.keys(limitedClusterFeatures || {}).length === 0 &&
|
|
145
|
-
!isSingleClusterFeatureEnabled,
|
|
140
|
+
isFullySupported: hasSupportedVersion && Object.keys(limitedClusterFeatures || {}).length === 0,
|
|
146
141
|
};
|
|
147
142
|
};
|
|
148
143
|
|
|
@@ -150,25 +145,11 @@ const SupportLevel = ({ cluster }: SupportLevelProps) => {
|
|
|
150
145
|
const { t } = useTranslation();
|
|
151
146
|
const featureSupportLevelData = useNewFeatureSupportLevel();
|
|
152
147
|
const { isSupportedOpenShiftVersion } = useOpenShiftVersionsContext();
|
|
153
|
-
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
|
|
154
148
|
|
|
155
149
|
const { limitedClusterFeatures, hasSupportedVersion, isFullySupported } =
|
|
156
150
|
React.useMemo<SupportLevelMemo>(
|
|
157
|
-
() =>
|
|
158
|
-
|
|
159
|
-
cluster,
|
|
160
|
-
featureSupportLevelData,
|
|
161
|
-
isSupportedOpenShiftVersion,
|
|
162
|
-
t,
|
|
163
|
-
isSingleClusterFeatureEnabled,
|
|
164
|
-
),
|
|
165
|
-
[
|
|
166
|
-
cluster,
|
|
167
|
-
featureSupportLevelData,
|
|
168
|
-
t,
|
|
169
|
-
isSupportedOpenShiftVersion,
|
|
170
|
-
isSingleClusterFeatureEnabled,
|
|
171
|
-
],
|
|
151
|
+
() => getSupportLevelInfo(cluster, featureSupportLevelData, isSupportedOpenShiftVersion, t),
|
|
152
|
+
[cluster, featureSupportLevelData, t, isSupportedOpenShiftVersion],
|
|
172
153
|
);
|
|
173
154
|
|
|
174
155
|
if (!limitedClusterFeatures) {
|
|
@@ -184,7 +165,7 @@ const SupportLevel = ({ cluster }: SupportLevelProps) => {
|
|
|
184
165
|
) : (
|
|
185
166
|
<LimitedSupportedCluster
|
|
186
167
|
clusterFeatureSupportLevels={limitedClusterFeatures}
|
|
187
|
-
showVersionWarning={!hasSupportedVersion
|
|
168
|
+
showVersionWarning={!hasSupportedVersion}
|
|
188
169
|
/>
|
|
189
170
|
)
|
|
190
171
|
}
|
|
@@ -171,11 +171,5 @@ const ClustersService = {
|
|
|
171
171
|
this.getUpdateManifestParams(existingManifest, updatedManifest),
|
|
172
172
|
);
|
|
173
173
|
},
|
|
174
|
-
registerDisconnected(params: { name: string; openshiftVersion: string }) {
|
|
175
|
-
return ClustersAPI.registerDisconnected({
|
|
176
|
-
name: params.name,
|
|
177
|
-
openshiftVersion: params.openshiftVersion,
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
174
|
};
|
|
181
175
|
export default ClustersService;
|
|
@@ -93,6 +93,14 @@ const HostsService = {
|
|
|
93
93
|
return HostsAPI.bindHost(host.infraEnvId, host.id, clusterId);
|
|
94
94
|
},
|
|
95
95
|
|
|
96
|
+
unbind(host: Host) {
|
|
97
|
+
if (!host.infraEnvId) {
|
|
98
|
+
throw new Error(`Cannot unbind host ${host.id}, missing infraEnvId`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return HostsAPI.unbindHost(host.infraEnvId, host.id);
|
|
102
|
+
},
|
|
103
|
+
|
|
96
104
|
installAll(hosts: Host[]) {
|
|
97
105
|
const promises = [];
|
|
98
106
|
for (const host of hosts) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@openshift-assisted/locales": "2.48.
|
|
4
|
-
"@openshift-assisted/types": "2.48.
|
|
3
|
+
"@openshift-assisted/locales": "2.48.5",
|
|
4
|
+
"@openshift-assisted/types": "2.48.5",
|
|
5
5
|
"@openshift-console/dynamic-plugin-sdk": "0.0.3",
|
|
6
6
|
"@patternfly/patternfly": "6.2.3",
|
|
7
7
|
"@patternfly/react-code-editor": "6.2.2",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
"version": "2.48.
|
|
143
|
+
"version": "2.48.5"
|
|
144
144
|
}
|
package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalConfigurationsStep.d.ts","sourceRoot":"","sources":["../../../../../../lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6C/B,QAAA,MAAM,0BAA0B,yBAyJ/B,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,128 +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 formik_1 = require("formik");
|
|
6
|
-
const Yup = tslib_1.__importStar(require("yup"));
|
|
7
|
-
const common_1 = require("../../../../common");
|
|
8
|
-
const react_core_1 = require("@patternfly/react-core");
|
|
9
|
-
const ClusterWizardContext_1 = require("../ClusterWizardContext");
|
|
10
|
-
const ClusterWizardFooter_1 = tslib_1.__importDefault(require("../ClusterWizardFooter"));
|
|
11
|
-
const ClusterWizardNavigation_1 = tslib_1.__importDefault(require("../ClusterWizardNavigation"));
|
|
12
|
-
const WithErrorBoundary_1 = require("../../../../common/components/ErrorHandling/WithErrorBoundary");
|
|
13
|
-
const UploadSSH_1 = tslib_1.__importDefault(require("../../../../common/components/clusterConfiguration/UploadSSH"));
|
|
14
|
-
const PullSecretField_1 = tslib_1.__importDefault(require("../../../../common/components/ui/formik/PullSecretField"));
|
|
15
|
-
const api_1 = require("../../../../common/api");
|
|
16
|
-
const AlertsContextProvider_1 = require("../../../../common/components/AlertsContextProvider");
|
|
17
|
-
const react_core_2 = require("@patternfly/react-core");
|
|
18
|
-
const InfraEnvsService_1 = tslib_1.__importDefault(require("../../../services/InfraEnvsService"));
|
|
19
|
-
const apis_1 = require("../../../services/apis");
|
|
20
|
-
const usePullSecret_1 = tslib_1.__importDefault(require("../../../hooks/usePullSecret"));
|
|
21
|
-
const react_router_dom_v5_compat_1 = require("react-router-dom-v5-compat");
|
|
22
|
-
const ClustersService_1 = tslib_1.__importDefault(require("../../../services/ClustersService"));
|
|
23
|
-
const PullSecretSync = ({ pullSecret }) => {
|
|
24
|
-
const { setFieldValue } = (0, formik_1.useFormikContext)();
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
if (pullSecret !== undefined) {
|
|
27
|
-
setFieldValue('pullSecret', pullSecret);
|
|
28
|
-
}
|
|
29
|
-
}, [pullSecret, setFieldValue]);
|
|
30
|
-
return null;
|
|
31
|
-
};
|
|
32
|
-
const OptionalConfigurationsStep = () => {
|
|
33
|
-
const pullSecret = (0, usePullSecret_1.default)() || '';
|
|
34
|
-
const { clusterId } = (0, react_router_dom_v5_compat_1.useParams)();
|
|
35
|
-
const [cluster, setCluster] = React.useState(null);
|
|
36
|
-
const { moveNext, moveBack, setDisconnectedInfraEnv, disconnectedInfraEnv } = (0, ClusterWizardContext_1.useClusterWizardContext)();
|
|
37
|
-
const { addAlert } = (0, AlertsContextProvider_1.useAlerts)();
|
|
38
|
-
const [editPullSecret, setEditPullSecret] = React.useState(false);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
const fetchCluster = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
if (!clusterId) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
const fetchedCluster = yield ClustersService_1.default.get(clusterId);
|
|
46
|
-
setCluster(fetchedCluster);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
(0, api_1.handleApiError)(error, () => {
|
|
50
|
-
addAlert({
|
|
51
|
-
title: 'Failed to fetch cluster',
|
|
52
|
-
message: (0, api_1.getApiErrorMessage)(error),
|
|
53
|
-
variant: react_core_2.AlertVariant.danger,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
void fetchCluster();
|
|
59
|
-
}, [clusterId, addAlert]);
|
|
60
|
-
const validationSchema = React.useMemo(() => Yup.object().shape({
|
|
61
|
-
sshPublicKey: common_1.sshPublicKeyValidationSchema,
|
|
62
|
-
pullSecret: common_1.pullSecretValidationSchema,
|
|
63
|
-
}), []);
|
|
64
|
-
const initialValues = {
|
|
65
|
-
sshPublicKey: '',
|
|
66
|
-
pullSecret: pullSecret,
|
|
67
|
-
};
|
|
68
|
-
return (React.createElement(formik_1.Formik, { initialValues: initialValues, validate: (0, common_1.getRichTextValidation)(validationSchema), onSubmit: (values) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
if (!cluster || !cluster.id) {
|
|
70
|
-
addAlert({
|
|
71
|
-
title: 'Missing cluster',
|
|
72
|
-
message: 'Cluster must be created before configuring infrastructure environment',
|
|
73
|
-
variant: react_core_2.AlertVariant.danger,
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
// Check if infraEnv already exists
|
|
79
|
-
if (disconnectedInfraEnv && disconnectedInfraEnv.id) {
|
|
80
|
-
// Update existing infraEnv
|
|
81
|
-
const updateParams = Object.assign({ pullSecret: values.pullSecret || pullSecret }, (values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }));
|
|
82
|
-
const { data: updatedInfraEnv } = yield apis_1.InfraEnvsAPI.update(disconnectedInfraEnv.id, updateParams);
|
|
83
|
-
setDisconnectedInfraEnv(updatedInfraEnv);
|
|
84
|
-
moveNext();
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// Create infraEnv with all params
|
|
88
|
-
const createParams = Object.assign({ name: `disconnected-cluster_infra-env`, pullSecret: values.pullSecret || pullSecret, clusterId: cluster.id, openshiftVersion: cluster.openshiftVersion, cpuArchitecture: 'x86_64' }, (values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }));
|
|
89
|
-
const createdInfraEnv = yield InfraEnvsService_1.default.create(createParams);
|
|
90
|
-
setDisconnectedInfraEnv(createdInfraEnv);
|
|
91
|
-
moveNext();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
(0, api_1.handleApiError)(error, () => {
|
|
96
|
-
addAlert({
|
|
97
|
-
title: disconnectedInfraEnv && disconnectedInfraEnv.id
|
|
98
|
-
? 'Failed to update infrastructure environment'
|
|
99
|
-
: 'Failed to create infrastructure environment',
|
|
100
|
-
message: (0, api_1.getApiErrorMessage)(error),
|
|
101
|
-
variant: react_core_2.AlertVariant.danger,
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}) }, ({ submitForm, isValid, errors, touched, isSubmitting }) => {
|
|
106
|
-
const errorFields = (0, common_1.getFormikErrorFields)(errors, touched);
|
|
107
|
-
const handleNext = () => {
|
|
108
|
-
void submitForm(); // This will trigger onSubmit
|
|
109
|
-
};
|
|
110
|
-
return (React.createElement(common_1.ClusterWizardStep, { navigation: React.createElement(ClusterWizardNavigation_1.default, null), footer: React.createElement(ClusterWizardFooter_1.default, { disconnectedClusterId: clusterId, onNext: handleNext, onBack: moveBack, isNextDisabled: !isValid, errorFields: errorFields, isSubmitting: isSubmitting }) },
|
|
111
|
-
React.createElement(WithErrorBoundary_1.WithErrorBoundary, { title: "Failed to load Optional Configurations step" },
|
|
112
|
-
React.createElement(PullSecretSync, { pullSecret: pullSecret }),
|
|
113
|
-
React.createElement(react_core_1.Grid, { hasGutter: true },
|
|
114
|
-
React.createElement(react_core_1.GridItem, null,
|
|
115
|
-
React.createElement(react_core_1.Split, null,
|
|
116
|
-
React.createElement(react_core_1.SplitItem, null,
|
|
117
|
-
React.createElement(react_core_1.Content, { component: "h2" }, "Optional configurations")),
|
|
118
|
-
React.createElement(react_core_1.SplitItem, null,
|
|
119
|
-
React.createElement(common_1.TechnologyPreview, null)))),
|
|
120
|
-
React.createElement(react_core_1.GridItem, null,
|
|
121
|
-
React.createElement(react_core_1.Form, { id: "wizard-cluster-optional-configurations__form" },
|
|
122
|
-
React.createElement(UploadSSH_1.default, null),
|
|
123
|
-
React.createElement(react_core_1.Checkbox, { label: "Edit pull secret", isChecked: editPullSecret, onChange: (_, checked) => setEditPullSecret(checked), id: "edit-pull-secret-checkbox" }),
|
|
124
|
-
(editPullSecret || !pullSecret) && React.createElement(PullSecretField_1.default, { isOcm: api_1.isInOcm })))))));
|
|
125
|
-
}));
|
|
126
|
-
};
|
|
127
|
-
exports.default = OptionalConfigurationsStep;
|
|
128
|
-
//# sourceMappingURL=OptionalConfigurationsStep.js.map
|
package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalConfigurationsStep.js","sourceRoot":"","sources":["../../../../../../lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,mCAAkD;AAClD,iDAA2B;AAC3B,+CAO4B;AAC5B,uDAAmG;AACnG,kEAAkE;AAClE,yFAAyD;AACzD,iGAAiE;AACjE,qGAAkG;AAClG,qHAAqF;AACrF,sHAAsF;AACtF,gDAAqF;AACrF,+FAAgF;AAChF,uDAAsD;AACtD,kGAAkE;AAClE,iDAAsD;AACtD,yFAAyD;AACzD,2EAAuD;AACvD,gGAAgE;AAQhE,MAAM,cAAc,GAAsC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;IAC3E,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,yBAAgB,GAAoC,CAAC;IAE/E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,aAAa,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;SACzC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;IA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KAAK,EAAC,6CAA6C;gBACpE,oBAAC,cAAc,IAAC,UAAU,EAAE,UAAU,GAAI;gBAC1C,oBAAC,iBAAI,IAAC,SAAS;oBACb,oBAAC,qBAAQ;wBACP,oBAAC,kBAAK;4BACJ,oBAAC,sBAAS;gCACR,oBAAC,oBAAO,IAAC,SAAS,EAAC,IAAI,8BAAkC,CAC/C;4BACZ,oBAAC,sBAAS;gCACR,oBAAC,0BAAiB,OAAG,CACX,CACN,CACC;oBACX,oBAAC,qBAAQ;wBACP,oBAAC,iBAAI,IAAC,EAAE,EAAC,8CAA8C;4BACrD,oBAAC,mBAAS,OAAG;4BACb,oBAAC,qBAAQ,IACP,KAAK,EAAC,kBAAkB,EACxB,SAAS,EAAE,cAAc,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,EACpD,EAAE,EAAC,2BAA2B,GAC9B;4BACD,CAAC,cAAc,IAAI,CAAC,UAAU,CAAC,IAAI,oBAAC,yBAAe,IAAC,KAAK,EAAE,aAAO,GAAI,CAClE,CACE,CACN,CACW,CACF,CACrB,CAAC;IACJ,CAAC,CACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -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;
|