Skip to content

Commit

Permalink
webui: get next button label and variant from the components
Browse files Browse the repository at this point in the history
AnacondaWizard should be agnostic to specific steps.
  • Loading branch information
KKoukiou committed Oct 19, 2023
1 parent eb0cb0a commit 84e9406
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 5 additions & 13 deletions ui/webui/src/components/AnacondaWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {

import { AnacondaPage } from "./AnacondaPage.jsx";
import { InstallationMethod, getPageProps as getInstallationMethodProps } from "./storage/InstallationMethod.jsx";
import { getScenario, getDefaultScenario } from "./storage/InstallationScenario.jsx";
import { getDefaultScenario } from "./storage/InstallationScenario.jsx";
import { MountPointMapping, getPageProps as getMountPointMappingProps } from "./storage/MountPointMapping.jsx";
import { DiskEncryption, getStorageEncryptionState, getPageProps as getDiskEncryptionProps } from "./storage/DiskEncryption.jsx";
import { InstallationLanguage, getPageProps as getInstallationLanguageProps } from "./localization/InstallationLanguage.jsx";
Expand Down Expand Up @@ -348,19 +348,11 @@ const Footer = ({
<WizardFooter>
<WizardContextConsumer>
{({ activeStep, onNext, onBack }) => {
const currentStep = stepsOrder.find(s => s.id === activeStep.id);
const footerHelperText = currentStep?.footerHelperText;
const isFirstScreen = stepsOrder.filter(step => !step.isHidden)[0].id === activeStep.id;
const nextButtonText = (
activeStep.id === "installation-review"
? getScenario(storageScenarioId).buttonLabel
: _("Next")
);
const nextButtonVariant = (
activeStep.id === "installation-review"
? "warning"
: "primary"
);

const footerHelperText = stepsOrder.find(step => step.id === activeStep.id)?.footerHelperText;
const nextButtonText = currentStep?.nextButtonText || _("Next");
const nextButtonVariant = currentStep?.nextButtonVariant || "primary";

return (
<Stack hasGutter>
Expand Down
2 changes: 2 additions & 0 deletions ui/webui/src/components/review/ReviewConfiguration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,7 @@ export const getPageProps = ({ storageScenarioId }) => {
label: _("Review and install"),
title: _("Review and install"),
footerHelperText: <ReviewConfigurationFooterHelperText storageScenarioId={storageScenarioId} />,
nextButtonText: getScenario(storageScenarioId).buttonLabel,
nextButtonVariant: "warning",
});
};

0 comments on commit 84e9406

Please sign in to comment.