[FleetUI] All hosts transferred to "No Team" after using "Select all matching hosts" with filters applied
Fleet version: v4.44.1
💥 Actual behavior
When attempting to transfer all hosts out of a team with more than 50 hosts, all hosts were transferred instead of only the hosts in the original team.
The customer filtered the Hosts view by the team hosts were being transferred from, and then used the check box to select all hosts on the page, then "Select all matching hosts" and transferred selected hosts to "No Team".
After the transfer was complete, all hosts had been transferred rather than the expected host count displayed in the UI for matching hosts.
When the transfer was complete
🧑💻 Steps to reproduce
- TODO
- TODO
🕯️ More info (optional)
Reproduced in my local environment. This bug triggers when, due to the host count exceeding the 50 per page display, the user selects "select all matching hosts.:
As an additional test, I verified this behavior does not apply to the Delete action.
Ok, looking into this, the select all hosts is hitting the transfer hosts to a team by filter endpoint. That endpoint doesn't have a filter option for team, only status, query, and label. https://fleetdm.com/docs/rest-api/rest-api#transfer-hosts-to-a-team-by-filter
I believe this should be reconsidered as a backend bug as we should still use this API end point, but the fix on the backend would be to take in current team ID as one of the filters for `hosts/transfer/filter
Need backend folk to confirm. Maybe @lucasmrod @getvictor or @gillespi314 ?
Also, since that API only transfers on those parameters, what happens if you try to click "select all hosts" for something like all hosts failing a policy? Wouldn't that also be buggy?
Also, since that API only transfers on those parameters, what happens if you try to click "select all hosts" for something like all hosts failing a policy? Wouldn't that also be buggy?
Yes, I think so. Looks like the backend essentially ignores any fields included in the request that are not expressly specified.
Yes, backend should be able to filter by team_id. I'm not sure how to select all hosts failing a policy -- that's not an option I see.
I couldn't think of a haiku this time. (See fleetdm.com logs for more information.)