mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Fleet UI: Fix conditions to ensure script modal doesn't open for nonscript installs (#35078)
This commit is contained in:
parent
509794e6a6
commit
044a1a9eca
2 changed files with 7 additions and 2 deletions
|
|
@ -134,6 +134,7 @@ describe("InstallStatusCell - component", () => {
|
|||
software_package: createMockHostSoftwarePackage({
|
||||
name: "mock software.sh",
|
||||
}),
|
||||
source: "sh_packages",
|
||||
}),
|
||||
ui_status: "ran_script",
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue