mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
[released bug] Fleet Full stack: Allow teams filter when transferring hosts by filters (#17241)
This commit is contained in:
parent
4345690dd2
commit
316321e889
1
changes/16950-transfer-selected-all-hosts
Normal file
1
changes/16950-transfer-selected-all-hosts
Normal file
@ -0,0 +1 @@
|
||||
- Bug fix: Correctly transfer hosts on multiple pages between teams
|
@ -2994,7 +2994,7 @@ _Available in Fleet Premium_
|
||||
| Name | Type | In | Description |
|
||||
| ------- | ------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| team_id | integer | body | **Required**. The ID of the team you'd like to transfer the host(s) to. |
|
||||
| filters | object | body | **Required** Contains any of the following three properties: `query` for search query keywords. Searchable fields include `hostname`, `hardware_serial`, `uuid`, and `ipv4`. `status` to indicate the status of the hosts to return. Can either be `new`, `online`, `offline`, `mia` or `missing`. `label_id` to indicate the selected label. `label_id` and `status` cannot be used at the same time. |
|
||||
| filters | object | body | **Required** Contains any of the following four properties: `query` for search query keywords. Searchable fields include `hostname`, `hardware_serial`, `uuid`, and `ipv4`. `status` to indicate the status of the hosts to return. Can either be `new`, `online`, `offline`, `mia` or `missing`. `label_id` to indicate the selected label. `team_id` to indicate the selected team. Note: `label_id` and `status` cannot be used at the same time. |
|
||||
|
||||
#### Example
|
||||
|
||||
@ -3006,7 +3006,8 @@ _Available in Fleet Premium_
|
||||
{
|
||||
"team_id": 1,
|
||||
"filters": {
|
||||
"status": "online"
|
||||
"status": "online",
|
||||
"team_id": 2,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -1034,6 +1034,8 @@ const ManageHostsPage = ({
|
||||
setIsUpdatingHosts(true);
|
||||
|
||||
const teamId = typeof transferTeam.id === "number" ? transferTeam.id : null;
|
||||
const currentTeam = teamIdForApi;
|
||||
|
||||
let action = hostsAPI.transferToTeam(teamId, selectedHostIds);
|
||||
|
||||
if (isAllMatchingHostsSelected) {
|
||||
@ -1044,6 +1046,7 @@ const ManageHostsPage = ({
|
||||
query: searchQuery,
|
||||
status,
|
||||
labelId,
|
||||
currentTeam,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,7 @@ export interface IActionByFilter {
|
||||
query: string;
|
||||
status: string;
|
||||
labelId?: number;
|
||||
currentTeam?: number | null;
|
||||
}
|
||||
|
||||
export type ILoadHostDetailsExtension = "device_mapping" | "macadmins";
|
||||
@ -359,6 +360,7 @@ export default {
|
||||
query,
|
||||
status,
|
||||
labelId,
|
||||
currentTeam,
|
||||
}: IActionByFilter) => {
|
||||
const { HOSTS_TRANSFER_BY_FILTER } = endpoints;
|
||||
return sendRequest("POST", HOSTS_TRANSFER_BY_FILTER, {
|
||||
@ -367,6 +369,7 @@ export default {
|
||||
query,
|
||||
status,
|
||||
label_id: labelId,
|
||||
team_id: currentTeam,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -126,7 +126,9 @@ func (c *Client) TransferHosts(hosts []string, label string, status, searchQuery
|
||||
MatchQuery string `json:"query"`
|
||||
Status fleet.HostStatus `json:"status"`
|
||||
LabelID *uint `json:"label_id"`
|
||||
}{MatchQuery: searchQuery, Status: fleet.HostStatus(status), LabelID: labelIDPtr}}
|
||||
TeamID *uint `json:"team_id"`
|
||||
}{MatchQuery: searchQuery, Status: fleet.HostStatus(status), LabelID: labelIDPtr},
|
||||
}
|
||||
return c.authenticatedRequest(params, verb, path, &responseBody)
|
||||
}
|
||||
|
||||
|
@ -867,6 +867,7 @@ type addHostsToTeamByFilterRequest struct {
|
||||
MatchQuery string `json:"query"`
|
||||
Status fleet.HostStatus `json:"status"`
|
||||
LabelID *uint `json:"label_id"`
|
||||
TeamID *uint `json:"team_id"`
|
||||
} `json:"filters"`
|
||||
}
|
||||
|
||||
@ -883,6 +884,7 @@ func addHostsToTeamByFilterEndpoint(ctx context.Context, request interface{}, sv
|
||||
MatchQuery: req.Filters.MatchQuery,
|
||||
},
|
||||
StatusFilter: req.Filters.Status,
|
||||
TeamFilter: req.Filters.TeamID,
|
||||
}
|
||||
err := svc.AddHostsToTeamByFilter(ctx, req.TeamID, listOpt, req.Filters.LabelID)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user