Fleet UI: Fix conditions to ensure script modal doesn't open for nonscript installs (#35078)

This commit is contained in:
RachelElysia 2025-11-03 10:35:50 -05:00 committed by GitHub
parent 509794e6a6
commit 044a1a9eca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -134,6 +134,7 @@ describe("InstallStatusCell - component", () => {
software_package: createMockHostSoftwarePackage({
name: "mock software.sh",
}),
source: "sh_packages",
}),
ui_status: "ran_script",
}}

View file

@ -9,6 +9,7 @@ import {
IVPPHostSoftware,
SoftwareUninstallStatus,
IAppLastInstall,
SCRIPT_PACKAGE_SOURCES,
} from "interfaces/software";
import { Colors } from "styles/var/colors";
@ -497,15 +498,17 @@ const InstallStatusCell = ({
(software.status === "failed_install" || isInstalledInFleetAndUI)) ||
recentlyTakenAction;
const isScriptPackage = SCRIPT_PACKAGE_SOURCES.includes(software.source);
// Status groups and their click handlers
const displayStatusConfig = [
{
condition: true, // Allow click even if no last install to see details modal
condition: isScriptPackage, // Still allows click even if no last install to see details modal
statuses: ["Failed", "Run (pending)", "Ran"],
onClick: onClickScriptStatus,
},
{
condition: true, // Allow click even if no last install to see details modal
condition: !isScriptPackage, // Still allows click even if no last install to see details modal
statuses: ["Failed", "Install (pending)", "Installed"],
onClick: onClickInstallStatus,
},
@ -522,6 +525,7 @@ const InstallStatusCell = ({
];
// Find a matching config for the current display text
// Given the condition is met and the display text is in the statuses array
const match = displayStatusConfig.find(
({ condition, statuses }) =>
condition && statuses.includes(resolvedDisplayText as string)