From 0903381abe0e536f0c9b9489287943290bc15a4c Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:49:15 -0400 Subject: [PATCH] [released bug] Fleet UI: Fix ability to bulk delete hosts (#17909) --- changes/17621-bulk-delete-hosts-all-teams | 1 + frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx | 4 +--- frontend/services/entities/hosts.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 changes/17621-bulk-delete-hosts-all-teams diff --git a/changes/17621-bulk-delete-hosts-all-teams b/changes/17621-bulk-delete-hosts-all-teams new file mode 100644 index 000000000..ed210b165 --- /dev/null +++ b/changes/17621-bulk-delete-hosts-all-teams @@ -0,0 +1 @@ +- Fix UI's ability to bulk delete hosts when "All teams" is selected diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index c593631dd..0956b3413 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -1089,12 +1089,10 @@ const ManageHostsPage = ({ const onDeleteHostSubmit = async () => { setIsUpdatingHosts(true); - const teamId = isAnyTeamSelected ? currentTeamId ?? null : null; - try { await (isAllMatchingHostsSelected ? hostsAPI.destroyByFilter({ - teamId, + teamId: teamIdForApi, query: searchQuery, status, labelId: selectedLabel?.id, diff --git a/frontend/services/entities/hosts.ts b/frontend/services/entities/hosts.ts index fb0b4908a..c5598a3ae 100644 --- a/frontend/services/entities/hosts.ts +++ b/frontend/services/entities/hosts.ts @@ -116,7 +116,7 @@ export interface IExportHostsOptions { } export interface IActionByFilter { - teamId: number | null; + teamId?: number | null; query: string; status: string; labelId?: number;