mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Fleet UI: Store host's team on details page for correct RBAC dropdown (#13530)
This commit is contained in:
parent
32031a5b75
commit
dc97109841
2 changed files with 13 additions and 0 deletions
1
changes/13495-host-details-rbac
Normal file
1
changes/13495-host-details-rbac
Normal file
|
|
@ -0,0 +1 @@
|
|||
- Host details page - Bug fix RBAC dropdown options on refresh
|
||||
|
|
@ -124,6 +124,8 @@ const HostDetailsPage = ({
|
|||
isSandboxMode,
|
||||
isOnlyObserver,
|
||||
filteredHostsPath,
|
||||
availableTeams,
|
||||
setCurrentTeam,
|
||||
} = useContext(AppContext);
|
||||
const {
|
||||
setLastEditedQueryName,
|
||||
|
|
@ -346,6 +348,16 @@ const HostDetailsPage = ({
|
|||
setPathname(location.pathname + location.search);
|
||||
}, [location]);
|
||||
|
||||
// Used to set host's team in AppContext for RBAC action dropdown
|
||||
useEffect(() => {
|
||||
if (host?.team_id) {
|
||||
const hostsTeam = availableTeams?.find(
|
||||
(team) => team.id === host.team_id
|
||||
);
|
||||
setCurrentTeam(hostsTeam);
|
||||
}
|
||||
}, [host]);
|
||||
|
||||
const titleData = normalizeEmptyValues(
|
||||
pick(host, [
|
||||
"id",
|
||||
|
|
|
|||
Loading…
Reference in a new issue