Skip to content

Commit 329e21e

Browse files
committed
Add download kubeconfig wizard page
Signed-off-by: Elay Aharoni <elayaha@gmail.com>
1 parent 94b9fbd commit 329e21e

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizard.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
InfraEnv,
1717
InfraEnvUpdateParams,
1818
} from '@openshift-assisted/types/assisted-installer-service';
19+
import KubeconfigDownload from './KubeconfigDownload';
1920

2021
type ClusterWizardProps = {
2122
cluster: Cluster;
@@ -44,6 +45,8 @@ const ClusterWizard = ({ cluster, infraEnv, updateInfraEnv }: ClusterWizardProps
4445
case 'static-ip-network-wide-configurations':
4546
case 'static-ip-yaml-view':
4647
return <StaticIp cluster={cluster} infraEnv={infraEnv} updateInfraEnv={updateInfraEnv} />;
48+
case 'kubeconfig-download':
49+
return <KubeconfigDownload cluster={cluster} />;
4750
case 'cluster-details':
4851
default:
4952
return <ClusterDetails cluster={cluster} infraEnv={infraEnv} />;

libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ const getWizardStepIds = (
6969
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'custom-manifests', 1);
7070
}
7171
if (isSingleClusterFeatureEnabled) {
72-
// tentatively removed, proper waiting on support by backend
73-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'operators', 1);
72+
stepsCopy = addStepToClusterWizard(stepsCopy, 'networking', ['kubeconfig-download']);
7473
}
7574

7675
return stepsCopy;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import { ClusterWizardStep, ClusterWizardStepHeader } from '../../../common';
3+
import { useClusterWizardContext } from './ClusterWizardContext';
4+
import ClusterWizardFooter from './ClusterWizardFooter';
5+
import ClusterWizardNavigation from './ClusterWizardNavigation';
6+
import { WithErrorBoundary } from '../../../common/components/ErrorHandling/WithErrorBoundary';
7+
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
8+
import { Checkbox } from '@patternfly/react-core';
9+
10+
const KubeconfigDownload: React.FC<{ cluster: Cluster }> = ({ cluster }) => {
11+
const [isChecked, setIsChecked] = React.useState<boolean>(false);
12+
const clusterWizardContext = useClusterWizardContext();
13+
14+
const footer = (
15+
<ClusterWizardFooter
16+
cluster={cluster}
17+
onNext={() => clusterWizardContext.moveNext()}
18+
onBack={() => clusterWizardContext.moveBack()}
19+
isNextDisabled={!isChecked}
20+
nextButtonText="Download Kubeconfig"
21+
/>
22+
);
23+
24+
return (
25+
<ClusterWizardStep navigation={<ClusterWizardNavigation cluster={cluster} />} footer={footer}>
26+
<WithErrorBoundary title="Failed to load Kubeconfig Download step">
27+
<ClusterWizardStepHeader>Download Kubeconfig</ClusterWizardStepHeader>
28+
<Checkbox
29+
id="Kubeconfig-download-agreement"
30+
isChecked={isChecked}
31+
onChange={() => setIsChecked(!isChecked)}
32+
label="I understand that I need to download Kubeconfig file prior of proceeding with the cluster installation."
33+
/>
34+
</WithErrorBoundary>
35+
</ClusterWizardStep>
36+
);
37+
};
38+
39+
export default KubeconfigDownload;

libs/ui-lib/lib/ocm/components/clusterWizard/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const wizardStepNames: { [key in ClusterWizardStepsType]: string } = {
1111
networking: 'Networking',
1212
'custom-manifests': 'Custom manifests',
1313
review: 'Review and create',
14+
'kubeconfig-download': 'Download Kubeconfig',
1415
};
1516

1617
export const defaultWizardSteps: ClusterWizardStepsType[] = [

libs/ui-lib/lib/ocm/components/clusterWizard/wizardTransition.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export type ClusterWizardStepsType =
2828
| 'storage'
2929
| 'networking'
3030
| 'review'
31-
| 'custom-manifests';
31+
| 'custom-manifests'
32+
| 'kubeconfig-download';
3233

3334
const wizardStepsOrder: ClusterWizardStepsType[] = [
3435
'cluster-details',
@@ -40,6 +41,7 @@ const wizardStepsOrder: ClusterWizardStepsType[] = [
4041
'storage',
4142
'networking',
4243
'custom-manifests',
44+
'kubeconfig-download',
4345
'review',
4446
];
4547

@@ -245,6 +247,8 @@ const reviewStepValidationsMap: WizardStepValidationMap = {
245247
softValidationIds: [],
246248
};
247249

250+
const kubeconfigValidationMap = buildEmptyValidationsMap();
251+
248252
const customManifestsValidationsMap = buildEmptyValidationsMap();
249253

250254
export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardStepsType> = {
@@ -258,6 +262,7 @@ export const wizardStepsValidationsMap: WizardStepsValidationMap<ClusterWizardSt
258262
storage: storageStepValidationsMap,
259263
networking: networkingStepValidationsMap,
260264
review: reviewStepValidationsMap,
265+
'kubeconfig-download': kubeconfigValidationMap,
261266
};
262267

263268
export const allClusterWizardSoftValidationIds =

0 commit comments

Comments
 (0)