From b96ce7cdfdaf8f1e120d8cb08a5ae1ad180aa9ba Mon Sep 17 00:00:00 2001 From: jacobshandling <61553566+jacobshandling@users.noreply.github.com> Date: Thu, 29 May 2025 13:06:21 -0700 Subject: [PATCH] fix conditions for batch run ui disabling (#29599) ## For #29595 - Only depend on total filtered hosts count when selecting all hosts on all pages ![ezgif-3acee2170765d3](https://github.com/user-attachments/assets/4581409f-b8d7-45cf-94a4-24826bc0aec0) - [x] Manual QA for all new/changed functionality Co-authored-by: Jacob Shandling --- .../hosts/ManageHostsPage/ManageHostsPage.tsx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index 74254e4e36..6dd96d9dcc 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -1647,18 +1647,19 @@ const ManageHostsPage = ({ ); } else if (isAllTeamsSelected && isPremiumTier) { disableRunScriptBatchTooltipContent = "Select a team to run a script"; - } else if (runScriptBatchFilterNotSupported && isAllMatchingHostsSelected) { - disableRunScriptBatchTooltipContent = - "Choose different filters to run a script"; - } else if ( - // default to blocking until count API responds - !totalFilteredHostsCount || - totalFilteredHostsCount > MAX_SCRIPT_BATCH_TARGETS - ) { - disableRunScriptBatchTooltipContent = - "Target at most 5,000 hosts to run a script"; + } else if (isAllMatchingHostsSelected) { + if (runScriptBatchFilterNotSupported) { + disableRunScriptBatchTooltipContent = + "Choose different filters to run a script"; + } else if ( + // default to blocking until count API responds + !totalFilteredHostsCount || + totalFilteredHostsCount > MAX_SCRIPT_BATCH_TARGETS + ) { + disableRunScriptBatchTooltipContent = + "Target at most 5,000 hosts to run a script"; + } } - const secondarySelectActions: IActionButtonProps[] = [ { name: "run-script",