diff --git a/libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx b/libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx
index d18e88faac..5f09d61b45 100644
--- a/libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx
+++ b/libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetails.tsx
@@ -3,12 +3,7 @@ import { useLocation, useNavigate } from 'react-router-dom-v5-compat';
import { useDispatch } from 'react-redux';
import { useAlerts, LoadingState, ClusterWizardStep, ErrorState } from '../../../common';
import { usePullSecret } from '../../hooks';
-import {
- ClustersAPI,
- getApiErrorMessage,
- handleApiError,
- isUnknownServerError,
-} from '../../../common/api';
+import { getApiErrorMessage, handleApiError, isUnknownServerError } from '../../../common/api';
import { setServerUpdateError, updateCluster } from '../../store/slices/current-cluster/slice';
import { useClusterWizardContext } from './ClusterWizardContext';
import { canNextClusterDetails, ClusterWizardFlowStateNew } from './wizardTransition';
@@ -23,7 +18,6 @@ import {
UISettingService,
} from '../../services';
import { Cluster, InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
-import { useFeature } from '../../hooks/use-feature';
type ClusterDetailsProps = {
cluster?: Cluster;
@@ -44,7 +38,6 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
latestVersions: versions,
} = useOpenShiftVersionsContext();
const location = useLocation();
- const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
const handleClusterUpdate = React.useCallback(
async (
@@ -83,25 +76,6 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
const searchParams = new URLSearchParams(location.search);
const isAssistedMigration = searchParams.get('source') === 'assisted_migration';
const cluster = await ClustersService.create(params, isAssistedMigration);
- if (isSingleClusterFeatureEnabled) {
- try {
- await ClustersAPI.updateInstallConfig(
- cluster.id,
- JSON.stringify(JSON.stringify({ featureSet: 'TechPreviewNoUpgrade' })),
- );
- } catch (e) {
- handleApiError(e, () =>
- addAlert({
- title: 'Failed to update install-config',
- message: getApiErrorMessage(e),
- }),
- );
- if (isUnknownServerError(e as Error)) {
- dispatch(setServerUpdateError());
- }
- return;
- }
- }
navigate(`../${cluster.id}`, { state: ClusterWizardFlowStateNew });
await UISettingService.update(cluster.id, { addCustomManifests });
//TO-DO: Assisted-Migration. Provisional code. Needs to be removed when MTV integration be finished
@@ -117,7 +91,7 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
}
}
},
- [clearAlerts, location.search, navigate, addAlert, dispatch, isSingleClusterFeatureEnabled],
+ [clearAlerts, location.search, navigate, addAlert, dispatch],
);
const navigation = ;
diff --git a/libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx b/libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx
index dc3e4b5f82..7d9056441a 100644
--- a/libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx
+++ b/libs/ui-lib/lib/ocm/components/clusterWizard/HostDiscovery.tsx
@@ -8,6 +8,7 @@ import {
useAlerts,
getHostDiscoveryInitialValues,
useFormikAutoSave,
+ ClustersAPI,
} from '../../../common';
import HostInventory from '../clusterConfiguration/HostInventory';
import { useClusterWizardContext } from './ClusterWizardContext';
@@ -22,6 +23,7 @@ import {
Cluster,
V2ClusterUpdateParams,
} from '@openshift-assisted/types/assisted-installer-service';
+import { useFeature } from '../../hooks/use-feature';
const HostDiscoveryForm = ({ cluster }: { cluster: Cluster }) => {
const { alerts } = useAlerts();
@@ -29,6 +31,9 @@ const HostDiscoveryForm = ({ cluster }: { cluster: Cluster }) => {
const clusterWizardContext = useClusterWizardContext();
const isAutoSaveRunning = useFormikAutoSave();
const errorFields = getFormikErrorFields(errors, touched);
+ const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
+ const { addAlert } = useAlerts();
+ const dispatch = useDispatch();
const isNextDisabled =
!isValid ||
@@ -37,13 +42,36 @@ const HostDiscoveryForm = ({ cluster }: { cluster: Cluster }) => {
isSubmitting ||
!canNextHostDiscovery({ cluster });
+ const onNext = React.useCallback(async () => {
+ if (isSingleClusterFeatureEnabled) {
+ try {
+ await ClustersAPI.updateInstallConfig(
+ cluster.id,
+ JSON.stringify(JSON.stringify({ featureSet: 'TechPreviewNoUpgrade' })),
+ );
+ } catch (e) {
+ handleApiError(e, () =>
+ addAlert({
+ title: 'Failed to update install-config',
+ message: getApiErrorMessage(e),
+ }),
+ );
+ if (isUnknownServerError(e as Error)) {
+ dispatch(setServerUpdateError());
+ }
+ return;
+ }
+ }
+ clusterWizardContext.moveNext();
+ }, [addAlert, cluster.id, clusterWizardContext, dispatch, isSingleClusterFeatureEnabled]);
+
const footer = (
clusterWizardContext.moveNext()}
+ onNext={() => void onNext()}
onBack={() => clusterWizardContext.moveBack()}
isBackDisabled={isSubmitting || isAutoSaveRunning}
/>