From a64023a5af5e96bc05fa548cbcb5d945fd892a80 Mon Sep 17 00:00:00 2001 From: gillespi314 <73313222+gillespi314@users.noreply.github.com> Date: Tue, 7 Sep 2021 10:55:55 -0500 Subject: [PATCH] Hide enroll secret for team observer; align button (#1935) --- frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx | 5 +++-- frontend/pages/hosts/ManageHostsPage/_styles.scss | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx index 657f4c5293..d1e8eb4655 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx @@ -1381,7 +1381,7 @@ const mapStateToProps = (state, ownProps) => { const teams = memoizedGetEntity(state.entities.teams.data); // If there is no team_id, set selectedTeam to 0 so dropdown defaults to "All teams" - const selectedTeam = location.query?.team_id || 0; + const selectedTeam = parseInt(location.query?.team_id, 10) || 0; const currentUser = state.auth.user; const canAddNewHosts = @@ -1391,7 +1391,8 @@ const mapStateToProps = (state, ownProps) => { const canEnrollHosts = permissionUtils.isGlobalAdmin(currentUser) || permissionUtils.isGlobalMaintainer(currentUser) || - (permissionUtils.isAnyTeamMaintainer(currentUser) && selectedTeam !== 0); + (selectedTeam !== 0 && + permissionUtils.isTeamMaintainer(currentUser, selectedTeam)); const canAddNewLabels = permissionUtils.isGlobalAdmin(currentUser) || permissionUtils.isGlobalMaintainer(currentUser); diff --git a/frontend/pages/hosts/ManageHostsPage/_styles.scss b/frontend/pages/hosts/ManageHostsPage/_styles.scss index 5632494631..86cebcca4a 100644 --- a/frontend/pages/hosts/ManageHostsPage/_styles.scss +++ b/frontend/pages/hosts/ManageHostsPage/_styles.scss @@ -6,6 +6,8 @@ margin-bottom: $pad-medium; .button-wrap { + display: flex; + justify-content: flex-end; min-width: 266px; } }