fix(edge/waitingroom): hide sidebar when disabled [EE-6003] (#10343)

pull/10398/head
Chaim Lev-Ari 1 year ago committed by GitHub
parent 20823a7f27
commit 5f9687a361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 { isBE } from '../portainer/feature-flags/feature-flags.service';
import { useSettings } from '../portainer/settings/queries';
import { SidebarItem } from './SidebarItem'; import { SidebarItem } from './SidebarItem';
import { SidebarSection } from './SidebarSection'; import { SidebarSection } from './SidebarSection';
export function EdgeComputeSidebar() { 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 ( return (
<SidebarSection title="Edge compute"> <SidebarSection title="Edge compute">
<SidebarItem <SidebarItem
@ -27,6 +37,14 @@ export function EdgeComputeSidebar() {
data-cy="portainerSidebar-edgeJobs" data-cy="portainerSidebar-edgeJobs"
/> />
{isBE && ( {isBE && (
<SidebarItem
to="edge.configurations"
label="Edge Configurations"
icon={Puzzle}
data-cy="portainerSidebar-edgeConfigurations"
/>
)}
{isBE && !settings.TrustOnFirstConnect && (
<SidebarItem <SidebarItem
to="edge.devices.waiting-room" to="edge.devices.waiting-room"
label="Waiting Room" label="Waiting Room"

@ -25,7 +25,7 @@ export function Sidebar() {
return null; return null;
} }
const { EnableEdgeComputeFeatures, LogoURL } = settingsQuery.data; const { LogoURL } = settingsQuery.data;
return ( return (
/* in the future (when we remove r2a) this should wrap the whole app - to change root styles */ /* in the future (when we remove r2a) this should wrap the whole app - to change root styles */
@ -50,7 +50,7 @@ export function Sidebar() {
data-cy="portainerSidebar-home" data-cy="portainerSidebar-home"
/> />
<EnvironmentSidebar /> <EnvironmentSidebar />
{isAdmin && EnableEdgeComputeFeatures && <EdgeComputeSidebar />} {isAdmin && <EdgeComputeSidebar />}
<SettingsSidebar isAdmin={isAdmin} isTeamLeader={isTeamLeader} /> <SettingsSidebar isAdmin={isAdmin} isTeamLeader={isTeamLeader} />
</ul> </ul>
</div> </div>

Loading…
Cancel
Save