From 5f9687a3614a2386afebdebb2c26f9e1602afd15 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Thu, 5 Oct 2023 10:31:08 +0300 Subject: [PATCH] fix(edge/waitingroom): hide sidebar when disabled [EE-6003] (#10343) --- app/react/sidebar/EdgeComputeSidebar.tsx | 20 +++++++++++++++++++- app/react/sidebar/Sidebar.tsx | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/react/sidebar/EdgeComputeSidebar.tsx b/app/react/sidebar/EdgeComputeSidebar.tsx index e7614898b..d9924986f 100644 --- a/app/react/sidebar/EdgeComputeSidebar.tsx +++ b/app/react/sidebar/EdgeComputeSidebar.tsx @@ -1,11 +1,21 @@ -import { Box, Clock, LayoutGrid, Layers } from 'lucide-react'; +import { Box, Clock, LayoutGrid, Layers, Puzzle } from 'lucide-react'; import { isBE } from '../portainer/feature-flags/feature-flags.service'; +import { useSettings } from '../portainer/settings/queries'; import { SidebarItem } from './SidebarItem'; import { SidebarSection } from './SidebarSection'; export function EdgeComputeSidebar() { + // this sidebar is rendered only for admins, so we can safely assume that settingsQuery will succeed + const settingsQuery = useSettings(); + + if (!settingsQuery.data || !settingsQuery.data.EnableEdgeComputeFeatures) { + return null; + } + + const settings = settingsQuery.data; + return ( {isBE && ( + + )} + {isBE && !settings.TrustOnFirstConnect && ( - {isAdmin && EnableEdgeComputeFeatures && } + {isAdmin && }