({
isValid: false,
software: { isValid: false },
});
@@ -163,6 +172,12 @@ const PackageForm = ({
setFormValidation(generateFormValidation(newData));
};
+ const onChangeInstallType = (value: string) => {
+ const installType = value as InstallType;
+ const newData = { ...formData, installType };
+ setFormData(newData);
+ };
+
const onToggleSelfServiceCheckbox = (value: boolean) => {
const newData = { ...formData, selfService: value };
setFormData(newData);
@@ -194,6 +209,18 @@ const PackageForm = ({
const classNames = classnames(baseClass, className);
+ const ext = formData?.software?.name.split(".").pop() as PackageType;
+ const isExePackage = ext === "exe";
+
+ // If a user preselects automatic install and then uploads a .exe
+ // which automatic install is not supported, the form will default
+ // back to manual install
+ useEffect(() => {
+ if (isExePackage && formData.installType === "automatic") {
+ onChangeInstallType("manual");
+ }
+ }, [isExePackage]);
+
return (