From c646817bc249580cf138d5220958bc24a3a179e9 Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:13:57 -0700 Subject: [PATCH] UI, Premium to Sandbox addendum 2: Hide Controls page (#11428) ## Addresses 2 of 2 [additional specs for premium to sandbox](https://fleetdm.slack.com/archives/C01EZVBHFHU/p1682644171632189) - Hides the Controls page in Sandbox mode ## Checklist for submitter - [x] Manual QA for all new/changed functionality Co-authored-by: Jacob Shandling --- .../top_nav/SiteTopNav/SiteTopNav.tsx | 7 ++++--- .../components/top_nav/SiteTopNav/navItems.ts | 5 +++-- frontend/router/index.tsx | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/frontend/components/top_nav/SiteTopNav/SiteTopNav.tsx b/frontend/components/top_nav/SiteTopNav/SiteTopNav.tsx index 34f2769be5..6be6228237 100644 --- a/frontend/components/top_nav/SiteTopNav/SiteTopNav.tsx +++ b/frontend/components/top_nav/SiteTopNav/SiteTopNav.tsx @@ -13,7 +13,7 @@ import UserMenu from "components/top_nav/UserMenu"; // @ts-ignore import OrgLogoIcon from "components/icons/OrgLogoIcon"; -import navItems, { INavItem } from "./navItems"; +import getNavItems, { INavItem } from "./navItems"; interface ISiteTopNavProps { config: IConfig; @@ -191,13 +191,14 @@ const SiteTopNav = ({ ); }; - const userNavItems = navItems( + const userNavItems = getNavItems( currentUser, isGlobalAdmin, isAnyTeamAdmin, isAnyTeamMaintainer, isGlobalMaintainer, - isNoAccess + isNoAccess, + isSandboxMode ); const renderNavItems = () => { diff --git a/frontend/components/top_nav/SiteTopNav/navItems.ts b/frontend/components/top_nav/SiteTopNav/navItems.ts index 9f482a4e58..203e14f597 100644 --- a/frontend/components/top_nav/SiteTopNav/navItems.ts +++ b/frontend/components/top_nav/SiteTopNav/navItems.ts @@ -20,7 +20,8 @@ export default ( isAnyTeamAdmin = false, isAnyTeamMaintainer = false, isGlobalMaintainer = false, - isNoAccess = false + isNoAccess = false, + isSandboxMode = false ): INavItem[] => { if (!user) { return []; @@ -59,7 +60,7 @@ export default ( regex: new RegExp(`^${URL_PREFIX}/controls/`), pathname: PATHS.CONTROLS, }, - exclude: !isMaintainerOrAdmin, + exclude: isSandboxMode || !isMaintainerOrAdmin, withParams: { type: "query", names: ["team_id"] }, }, { diff --git a/frontend/router/index.tsx b/frontend/router/index.tsx index cf06b31b1f..15108238ca 100644 --- a/frontend/router/index.tsx +++ b/frontend/router/index.tsx @@ -170,14 +170,16 @@ const routes = ( - - - - - - - - + + + + + + + + + +