@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
54 lines • 7.22 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterDeploymentWizard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const react_core_1 = require("@patternfly/react-core");
const common_1 = require("../../../common");
const ClusterDeploymentDetailsStep_1 = tslib_1.__importDefault(require("./ClusterDeploymentDetailsStep"));
const ClusterDeploymentNetworkingStep_1 = tslib_1.__importDefault(require("./ClusterDeploymentNetworkingStep"));
const ClusterDeploymentHostSelectionStep_1 = tslib_1.__importDefault(require("./ClusterDeploymentHostSelectionStep"));
const ClusterDeploymentHostsDiscoveryStep_1 = tslib_1.__importDefault(require("./ClusterDeploymentHostsDiscoveryStep"));
const featureSupportLevels_1 = require("../featureSupportLevels");
const ClusterDeploymentReviewStep_1 = tslib_1.__importDefault(require("./ClusterDeploymentReviewStep"));
const YamlPreview_1 = require("../YamlPreview");
const constants_1 = require("./constants");
const ClusterDeploymentWizardContext_1 = require("./ClusterDeploymentWizardContext");
const helpers_1 = require("./helpers");
const ClusterDeploymentWizard = (_a) => {
var _b, _c;
var { className, onSaveDetails, onSaveNetworking, onSaveHostsSelection, onClose, onFinish, hostActions, usedClusterNames, fetchSecret, clusterDeployment, agentClusterInstall, agents, bareMetalHosts, clusterImages, aiConfigMap, infraEnv, fetchInfraEnv, initialStep, isPreviewOpen, setPreviewOpen, fetchManagedClusters, fetchKlusterletAddonConfig, onSaveISOParams, onCreateBMH, isNutanix, onChangeBMHHostname } = _a, rest = tslib_1.__rest(_a, ["className", "onSaveDetails", "onSaveNetworking", "onSaveHostsSelection", "onClose", "onFinish", "hostActions", "usedClusterNames", "fetchSecret", "clusterDeployment", "agentClusterInstall", "agents", "bareMetalHosts", "clusterImages", "aiConfigMap", "infraEnv", "fetchInfraEnv", "initialStep", "isPreviewOpen", "setPreviewOpen", "fetchManagedClusters", "fetchKlusterletAddonConfig", "onSaveISOParams", "onCreateBMH", "isNutanix", "onChangeBMHHostname"]);
const { t } = (0, use_translation_wrapper_1.useTranslation)();
const { code, loadingResources } = (0, YamlPreview_1.useYamlPreview)({
agentClusterInstall,
clusterDeployment,
fetchSecret,
fetchManagedClusters,
fetchKlusterletAddonConfig,
});
// if initialStep is set, it is either 'host-selection' or 'host-discovery', both at index 4
// if initialStep is not set, start at 'cluster-details' which is at index 2
const startIndex = initialStep ? 4 : 2;
const stepNames = (0, constants_1.wizardStepNames)(t);
const isAIFlow = !!infraEnv;
return (React.createElement(react_core_1.Grid, { style: { height: '100%' } },
React.createElement(react_core_1.GridItem, { span: isPreviewOpen ? 7 : 12 },
React.createElement(common_1.AlertsContextProvider, null,
React.createElement(featureSupportLevels_1.ACMFeatureSupportLevelProvider, { clusterImages: clusterImages, isEditClusterFlow: true },
React.createElement(ClusterDeploymentWizardContext_1.ClusterDeploymentWizardContextProvider, { agentClusterInstall: agentClusterInstall },
React.createElement(react_core_1.Wizard, { isVisitRequired: true, startIndex: startIndex, className: className, onClose: onClose },
React.createElement(react_core_1.WizardStep, { name: stepNames['installation-type'], id: 'installation-type', isDisabled: true }),
React.createElement(react_core_1.WizardStep, { name: stepNames['cluster-details'], id: 'cluster-details' },
React.createElement(ClusterDeploymentDetailsStep_1.default, { clusterImages: clusterImages, usedClusterNames: usedClusterNames, clusterDeployment: clusterDeployment, agentClusterInstall: agentClusterInstall, agents: agents, onSaveDetails: onSaveDetails, isPreviewOpen: isPreviewOpen, infraEnv: infraEnv, isNutanix: isNutanix })),
React.createElement(react_core_1.WizardStep, { name: stepNames['automation'], id: 'automation', isDisabled: true }),
(0, helpers_1.isCIMFlow)(clusterDeployment) ? (React.createElement(react_core_1.WizardStep, { name: stepNames['hosts-selection'], id: 'host-selection' }, ((_b = agentClusterInstall === null || agentClusterInstall === void 0 ? void 0 : agentClusterInstall.metadata) === null || _b === void 0 ? void 0 : _b.name) ? (React.createElement(ClusterDeploymentHostSelectionStep_1.default, { clusterDeployment: clusterDeployment, agentClusterInstall: agentClusterInstall, onSaveHostsSelection: onSaveHostsSelection, agents: agents, aiConfigMap: aiConfigMap, onEditRole: hostActions.onEditRole, onSetInstallationDiskId: hostActions.onSetInstallationDiskId, isNutanix: isNutanix })) : (React.createElement(common_1.LoadingState, null)))) : (React.createElement(react_core_1.WizardStep, { name: stepNames['hosts-discovery'], id: 'host-discovery' }, isAIFlow && onSaveISOParams && onCreateBMH ? (React.createElement(ClusterDeploymentHostsDiscoveryStep_1.default, Object.assign({ clusterDeployment: clusterDeployment, agentClusterInstall: agentClusterInstall, agents: agents, bareMetalHosts: bareMetalHosts, aiConfigMap: aiConfigMap, infraEnv: infraEnv, fetchSecret: fetchSecret, onChangeBMHHostname: onChangeBMHHostname, onEditRole: hostActions.onEditRole, onSetInstallationDiskId: hostActions.onSetInstallationDiskId, onDeleteHost: hostActions.onDeleteHost, onSaveISOParams: onSaveISOParams, onCreateBMH: onCreateBMH }, rest))) : (React.createElement(common_1.LoadingState, null)))),
React.createElement(react_core_1.WizardStep, { name: stepNames['networking'], id: 'networking' },
React.createElement(ClusterDeploymentNetworkingStep_1.default, { clusterDeployment: clusterDeployment, agentClusterInstall: agentClusterInstall, agents: agents, onSaveNetworking: onSaveNetworking, onEditHost: hostActions.onEditHost, onEditRole: hostActions.onEditRole, fetchInfraEnv: fetchInfraEnv, isPreviewOpen: isPreviewOpen, onSetInstallationDiskId: hostActions.onSetInstallationDiskId, isNutanix: isNutanix })),
React.createElement(react_core_1.WizardStep, { name: stepNames['review'], id: 'review' },
React.createElement(ClusterDeploymentReviewStep_1.default, { onFinish: onFinish, clusterDeployment: clusterDeployment, agentClusterInstall: agentClusterInstall, agents: agents, clusterImages: clusterImages, infraEnv: infraEnv }))))))),
isPreviewOpen && (React.createElement(react_core_1.GridItem, { span: 5 },
React.createElement(YamlPreview_1.YamlPreview, { code: code, setPreviewOpen: setPreviewOpen, loading: loadingResources }, `${((_c = clusterDeployment.metadata) === null || _c === void 0 ? void 0 : _c.name) || ''} cluster`)))));
};
exports.ClusterDeploymentWizard = ClusterDeploymentWizard;
//# sourceMappingURL=ClusterDeploymentWizard.js.map