= ({
Create Template
) : (
-
+
)}
+ {showContinueError && !canContinue && (
+
+ {getContinueErrorMessage(currentStep.id)}
+
+ )}
+
{currentStep.id === "base-infra" && }
@@ -377,6 +399,7 @@ interface StepContentProps {
onRemoveModule: (moduleId: string) => void;
registerModuleRef: (moduleId: string, node: HTMLDivElement | null) => void;
onCreate: (values: CustomizationsFormValues) => void;
+ showValidationErrors: boolean;
}
const StepContent: FC = ({
@@ -389,6 +412,7 @@ const StepContent: FC = ({
onRemoveModule,
registerModuleRef,
onCreate,
+ showValidationErrors,
}) => {
switch (stepId) {
case "base-infra":
@@ -407,6 +431,7 @@ const StepContent: FC = ({
onChangeValues={(values) =>
dispatch({ type: "SET_BASE_VARIABLES", values })
}
+ showErrors={showValidationErrors}
/>
);
case "module-select":
@@ -436,6 +461,7 @@ const StepContent: FC = ({
}
onRemoveModule={onRemoveModule}
registerModuleRef={registerModuleRef}
+ showErrors={showValidationErrors}
/>
);
case "customizations":
@@ -454,6 +480,23 @@ const StepContent: FC = ({
}
};
+/**
+ * Human-readable reason a step's requirements are not yet met, shown in red
+ * when the user clicks Continue on an incomplete step.
+ */
+function getContinueErrorMessage(stepId: StepId): string {
+ switch (stepId) {
+ case "base-infra":
+ return "Select a base template to continue.";
+ case "base-parameters":
+ return "Fill in all required parameters to continue.";
+ case "module-settings":
+ return "Fill in all required module settings to continue.";
+ default:
+ return "Complete this step to continue.";
+ }
+}
+
function computeCanContinue(
stepId: StepId,
state: TemplateBuilderWizardState,