Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions libs/ui-lib/lib/common/api/assisted-service/ClustersAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,6 @@ const ClustersAPI = {
headers: { 'Content-Type': 'application/json' },
});
},
registerDisconnected(params: { name: string; openshiftVersion: string }) {
return client.post<Cluster, AxiosResponse<Cluster>, { name: string; openshiftVersion: string }>(
`${ClustersAPI.makeBaseURI()}disconnected`,
params,
);
},
};

export default ClustersAPI;
2 changes: 1 addition & 1 deletion libs/ui-lib/lib/common/components/ui/WizardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const WizardFooter: React.FC<WizardFooterProps> = ({
variant={ButtonVariant.primary}
name="next"
onClick={onNext}
isDisabled={isNextDisabled || isSubmitting}
isDisabled={isNextDisabled}
isLoading={isNextButtonLoading}
>
{nextButtonText || t('ai:Next')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const GetPullSecretHelperText: React.FC<{ isOcm: boolean }> = ({ isOcm }) => {

const PullSecretField: React.FC<{ isOcm: boolean }> = ({ isOcm }) => {
const { t } = useTranslation();

return (
<TextAreaField
name="pullSecret"
Expand Down
3 changes: 0 additions & 3 deletions libs/ui-lib/lib/common/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ export const singleClusterOperators = [
OPERATOR_NAME_NODE_MAINTENANCE,
OPERATOR_NAME_FENCE_AGENTS_REMEDIATION,
OPERATOR_NAME_KUBE_DESCHEDULER,
OPERATOR_NAME_CLUSTER_OBSERVABILITY,
OPERATOR_NAME_LOKI,
OPERATOR_NAME_OPENSHIFT_LOGGING,
];

export const singleClusterBundles = ['virtualization'];
Expand Down
4 changes: 1 addition & 3 deletions libs/ui-lib/lib/ocm/components/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export const UILibRoutes = ({
<>
<Routes>
<Route path="assisted-installer/clusters" element={<Outlet />}>
<Route path="~new" element={<NewClusterPage />}>
<Route path=":clusterId" element={<NewClusterPage />} />
</Route>
<Route path="~new" element={<NewClusterPage />} />
<Route path=":clusterId" element={<ClusterPage />} />
<Route index element={<Clusters />} />
</Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ export const VirtualIPControlGroup = ({
name="apiVips.0.ip"
helperText={ipHelperText}
isRequired
maxLength={45}
labelInfo={isDualStack ? 'Primary' : undefined}
onChange={(e) =>
setVipValueAtIndex('apiVips', 0, e as React.ChangeEvent<HTMLInputElement>)
Expand All @@ -230,7 +229,6 @@ export const VirtualIPControlGroup = ({
}
name="apiVips.1.ip"
helperText={ipHelperText}
maxLength={45}
labelInfo={'Secondary'}
onChange={(e) =>
setVipValueAtIndex('apiVips', 1, e as React.ChangeEvent<HTMLInputElement>)
Expand All @@ -248,7 +246,6 @@ export const VirtualIPControlGroup = ({
}
helperText={ipHelperText}
isRequired
maxLength={45}
labelInfo={isDualStack ? 'Primary' : undefined}
onChange={(e) =>
setVipValueAtIndex('ingressVips', 0, e as React.ChangeEvent<HTMLInputElement>)
Expand All @@ -265,7 +262,6 @@ export const VirtualIPControlGroup = ({
</>
}
helperText={ipHelperText}
maxLength={45}
labelInfo={'Secondary'}
onChange={(e) =>
setVipValueAtIndex(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { HostsNetworkConfigurationType } from '../../services';
import { StaticIpView } from '../clusterConfiguration/staticIp/data/dataTypes';
import { ClusterWizardStepsType } from './wizardTransition';
import { UISettingsValues } from '../../../common';
import { InfraEnv } from '@openshift-assisted/types/assisted-installer-service';

export type ClusterWizardContextType = {
currentStepId: ClusterWizardStepsType;
Expand All @@ -21,8 +20,6 @@ export type ClusterWizardContextType = {
uiSettings?: UISettingsValues;
installDisconnected: boolean;
setInstallDisconnected: (enabled: boolean) => void;
disconnectedInfraEnv?: InfraEnv;
setDisconnectedInfraEnv: (infraEnv: InfraEnv | undefined) => void;
};

export const ClusterWizardContext = React.createContext<ClusterWizardContextType | null>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ const ClusterWizardContextProvider = ({
const [wizardPerPage, setWizardPerPage] = React.useState(10);
const [customManifestsStep, setCustomManifestsStep] = React.useState<boolean>(false);
const [installDisconnected, setInstallDisconnected] = React.useState(false);
const [disconnectedInfraEnv, setDisconnectedInfraEnv] = React.useState<InfraEnv | undefined>(
infraEnv,
);
const location = useLocation();
const locationState = location.state as ClusterWizardFlowStateType | undefined;
const {
Expand Down Expand Up @@ -262,8 +259,6 @@ const ClusterWizardContextProvider = ({
connectedWizardStepIds?.length && onSetCurrentStepId(connectedWizardStepIds[0]);
}
},
disconnectedInfraEnv,
setDisconnectedInfraEnv,
};
}, [
wizardStepIds,
Expand All @@ -278,7 +273,6 @@ const ClusterWizardContextProvider = ({
installDisconnected,
setInstallDisconnected,
connectedWizardStepIds,
disconnectedInfraEnv,
]);

if (!contextValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { onFetchEvents } from '../fetching/fetchEvents';
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
import { useFeature } from '../../hooks/use-feature';
import { useModalDialogsContext } from '../hosts/ModalDialogsContext';
import ClustersService from '../../services/ClustersService';
import { handleApiError, getApiErrorMessage } from '../../../common/api';

type ClusterValidationSectionProps = {
cluster?: Cluster;
Expand Down Expand Up @@ -73,7 +71,6 @@ type ClusterWizardFooterProps = WizardFooterGenericProps & {
errorFields?: string[];
alertTitle?: string;
alertContent?: string | null;
disconnectedClusterId?: string;
};

const ClusterWizardFooter = ({
Expand All @@ -83,37 +80,19 @@ const ClusterWizardFooter = ({
alertTitle,
alertContent,
onCancel,
disconnectedClusterId,
...rest
}: ClusterWizardFooterProps) => {
const { alerts, addAlert } = useAlerts();
const { alerts } = useAlerts();
const navigate = useNavigate();
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
const { currentStepId } = useClusterWizardContext();
const { resetSingleClusterDialog } = useModalDialogsContext();
const { setDisconnectedInfraEnv } = useClusterWizardContext();

const handleCancel = React.useCallback(async () => {
if (disconnectedClusterId) {
try {
await ClustersService.remove(disconnectedClusterId);
} catch (e) {
handleApiError(e, () =>
addAlert({
title: 'Failed to remove cluster',
message: getApiErrorMessage(e),
}),
);
}
}
setDisconnectedInfraEnv(undefined);
navigate('/cluster-list');
}, [navigate, setDisconnectedInfraEnv, addAlert, disconnectedClusterId]);
const handleCancel = React.useCallback(() => navigate('/cluster-list'), [navigate]);

const handleReset = React.useCallback(
() => resetSingleClusterDialog.open({ cluster }),
[resetSingleClusterDialog, cluster],
);
const handleReset = React.useCallback(() => {
resetSingleClusterDialog.open({ cluster });
}, [resetSingleClusterDialog, cluster]);

const alertsSection = alerts.length ? <Alerts /> : undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ClusterDetails from './ClusterDetails';
import { useClusterWizardContext } from './ClusterWizardContext';
import ReviewStep from './disconnected/ReviewStep';
import BasicStep from './disconnected/BasicStep';
import OptionalConfigurationsStep from './disconnected/OptionalConfigurationsStep';
import { ClusterWizardStepsType } from './wizardTransition';

const getCurrentStep = (currentStepId: ClusterWizardStepsType) => {
Expand All @@ -13,8 +12,6 @@ const getCurrentStep = (currentStepId: ClusterWizardStepsType) => {
return <ReviewStep />;
case 'disconnected-basic':
return <BasicStep />;
case 'disconnected-optional-configurations':
return <OptionalConfigurationsStep />;
default:
return <ClusterDetails />;
}
Expand Down
1 change: 0 additions & 1 deletion libs/ui-lib/lib/ocm/components/clusterWizard/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const wizardStepNames: { [key in ClusterWizardStepsType]: string } = {
'credentials-download': 'Download credentials',
'disconnected-review': 'Review and download ISO',
'disconnected-basic': 'Basic information',
'disconnected-optional-configurations': 'Optional configurations',
};

export const defaultWizardSteps: ClusterWizardStepsType[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,10 @@ import ClusterWizardNavigation from '../ClusterWizardNavigation';
import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
import InstallDisconnectedSwitch from './InstallDisconnectedSwitch';
import { Formik } from 'formik';
import ClustersService from '../../../services/ClustersService';
import { handleApiError, getApiErrorMessage } from '../../../../common/api';
import { useAlerts } from '../../../../common/components/AlertsContextProvider';
import { AlertVariant } from '@patternfly/react-core';
import { ClusterWizardFlowStateNew } from '../wizardTransition';
import { useLocation, useNavigate } from 'react-router-dom-v5-compat';
import { AxiosResponse } from 'axios';
import { Cluster } from '@openshift-assisted/types//assisted-installer-service';

const BasicStep = () => {
const { t } = useTranslation();
const { moveNext } = useClusterWizardContext();
const { addAlert } = useAlerts();
const [isSubmitting, setIsSubmitting] = React.useState(false);
const navigate = useNavigate();
const location = useLocation();
const currentPath = location.pathname;
let disconnectedClusterId: string | undefined;

const onNext = async () => {
try {
setIsSubmitting(true);
// Create cluster only - infraEnv will be created in OptionalConfigurationsStep
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { data: disconnectedCluster }: AxiosResponse<Cluster> =
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await ClustersService.registerDisconnected({
name: 'disconnected-cluster',
openshiftVersion: '4.20',
});
disconnectedClusterId = disconnectedCluster.id;
navigate(`${currentPath}/${disconnectedClusterId}`, {
state: ClusterWizardFlowStateNew,
});
moveNext();
} catch (error: unknown) {
handleApiError(error, () => {
addAlert({
title: 'Failed to create disconnected cluster',
message: getApiErrorMessage(error),
variant: AlertVariant.danger,
});
});
} finally {
setIsSubmitting(false);
}
};

return (
<Formik
Expand All @@ -72,15 +29,7 @@ const BasicStep = () => {
>
<ClusterWizardStep
navigation={<ClusterWizardNavigation />}
footer={
<ClusterWizardFooter
onNext={() => {
void onNext();
}}
isSubmitting={isSubmitting}
disconnectedClusterId={disconnectedClusterId}
/>
}
footer={<ClusterWizardFooter onNext={moveNext} />}
>
<WithErrorBoundary title="Failed to load Basic step">
<Grid hasGutter>
Expand Down
Loading
Loading