Fleet UI: .exe and .tar.gz add software clues fix (#35856)

This commit is contained in:
RachelElysia 2025-11-18 09:25:02 -05:00 committed by GitHub
parent 3029a3ac44
commit 55a7c4b63f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 8 deletions

View file

@ -218,6 +218,8 @@ const PackageAdvancedOptions = ({
);
};
const requiresAdvancedOptions = ext === "exe" || ext === "tar.gz";
return (
<div className={baseClass}>
<RevealButton
@ -227,12 +229,16 @@ const PackageAdvancedOptions = ({
hideText="Advanced options"
caretPosition="after"
onClick={() => setShowAdvancedOptions(!showAdvancedOptions)}
disabled={!selectedPackage}
disabled={!selectedPackage || requiresAdvancedOptions}
disabledTooltipContent={
<>
Choose a file to modify <br />
advanced options.
</>
requiresAdvancedOptions ? (
<>Install and uninstall scripts are required for .{ext} packages.</>
) : (
<>
Choose a file to modify <br />
advanced options.
</>
)
}
/>
{(showAdvancedOptions || ext === "exe" || ext === "tar.gz") &&

View file

@ -50,7 +50,10 @@ const FORM_VALIDATION_CONFIG: Record<
{
name: "requiredForExe",
isValid: (formData) => {
if (formData.software?.type === "exe") {
if (
formData.software?.type === "exe" ||
getExtensionFromFileName(formData.software?.name || "") === "exe"
) {
// Handle undefined safely with nullish coalescing
return (formData.installScript ?? "").trim().length > 0;
}
@ -66,7 +69,7 @@ const FORM_VALIDATION_CONFIG: Record<
getExtensionFromFileName(formData.software.name) === "tar.gz"
) {
// Handle undefined safely with nullish coalescing
return (formData.uninstallScript ?? "").trim().length > 0;
return (formData.installScript ?? "").trim().length > 0;
}
return true;
},
@ -79,7 +82,10 @@ const FORM_VALIDATION_CONFIG: Record<
{
name: "requiredForExe",
isValid: (formData) => {
if (formData.software?.type === "exe") {
if (
formData.software?.type === "exe" ||
getExtensionFromFileName(formData.software?.name || "") === "exe"
) {
// Handle undefined safely with nullish coalescing
return (formData.uninstallScript ?? "").trim().length > 0;
}