Fleet UI: Store host's team on details page for correct RBAC dropdown (#13530)

This commit is contained in:
RachelElysia 2023-08-28 13:11:19 -04:00 committed by GitHub
parent 32031a5b75
commit dc97109841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1 @@
- Host details page - Bug fix RBAC dropdown options on refresh

View file

@ -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",