@@ -3,7 +3,12 @@ import { useLocation, useNavigate } from 'react-router-dom-v5-compat';
3
3
import { useDispatch } from 'react-redux' ;
4
4
import { useAlerts , LoadingState , ClusterWizardStep , ErrorState } from '../../../common' ;
5
5
import { usePullSecret } from '../../hooks' ;
6
- import { getApiErrorMessage , handleApiError , isUnknownServerError } from '../../../common/api' ;
6
+ import {
7
+ ClustersAPI ,
8
+ getApiErrorMessage ,
9
+ handleApiError ,
10
+ isUnknownServerError ,
11
+ } from '../../../common/api' ;
7
12
import { setServerUpdateError , updateCluster } from '../../store/slices/current-cluster/slice' ;
8
13
import { useClusterWizardContext } from './ClusterWizardContext' ;
9
14
import { canNextClusterDetails , ClusterWizardFlowStateNew } from './wizardTransition' ;
@@ -18,6 +23,7 @@ import {
18
23
UISettingService ,
19
24
} from '../../services' ;
20
25
import { Cluster , InfraEnv } from '@openshift-assisted/types/assisted-installer-service' ;
26
+ import { useFeature } from '../../hooks/use-feature' ;
21
27
22
28
type ClusterDetailsProps = {
23
29
cluster ?: Cluster ;
@@ -38,6 +44,7 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
38
44
latestVersions : versions ,
39
45
} = useOpenShiftVersionsContext ( ) ;
40
46
const location = useLocation ( ) ;
47
+ const isSingleClusterFeatureEnabled = useFeature ( 'ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE' ) ;
41
48
42
49
const handleClusterUpdate = React . useCallback (
43
50
async (
@@ -76,6 +83,25 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
76
83
const searchParams = new URLSearchParams ( location . search ) ;
77
84
const isAssistedMigration = searchParams . get ( 'source' ) === 'assisted_migration' ;
78
85
const cluster = await ClustersService . create ( params , isAssistedMigration ) ;
86
+ if ( isSingleClusterFeatureEnabled ) {
87
+ try {
88
+ await ClustersAPI . updateInstallConfig (
89
+ cluster . id ,
90
+ JSON . stringify ( JSON . stringify ( { featureSet : 'TechPreviewNoUpgrade' } ) ) ,
91
+ ) ;
92
+ } catch ( e ) {
93
+ handleApiError ( e , ( ) =>
94
+ addAlert ( {
95
+ title : 'Failed to update install-config' ,
96
+ message : getApiErrorMessage ( e ) ,
97
+ } ) ,
98
+ ) ;
99
+ if ( isUnknownServerError ( e as Error ) ) {
100
+ dispatch ( setServerUpdateError ( ) ) ;
101
+ }
102
+ return ;
103
+ }
104
+ }
79
105
navigate ( `../${ cluster . id } ` , { state : ClusterWizardFlowStateNew } ) ;
80
106
await UISettingService . update ( cluster . id , { addCustomManifests } ) ;
81
107
//TO-DO: Assisted-Migration. Provisional code. Needs to be removed when MTV integration be finished
@@ -91,7 +117,7 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
91
117
}
92
118
}
93
119
} ,
94
- [ clearAlerts , location . search , navigate , addAlert , dispatch ] ,
120
+ [ clearAlerts , location . search , navigate , addAlert , dispatch , isSingleClusterFeatureEnabled ] ,
95
121
) ;
96
122
97
123
const navigation = < ClusterWizardNavigation cluster = { cluster } /> ;
0 commit comments