fix(edge/updates): hide sidebar item when disabled [EE-6294] (#10582)

pull/10426/merge
Chaim Lev-Ari 2023-11-05 12:45:56 +02:00 committed by GitHub
parent 47c9e498f9
commit e72671e4ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 8 deletions

View File

@ -96,14 +96,7 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
isSubMenu isSubMenu
data-cy="portainerSidebar-environmentTags" data-cy="portainerSidebar-environmentTags"
/> />
{isBE && ( <EdgeUpdatesSidebarItem />
<SidebarItem
to="portainer.endpoints.updateSchedules"
label="Update & Rollback"
isSubMenu
data-cy="portainerSidebar-updateSchedules"
/>
)}
</SidebarParent> </SidebarParent>
<SidebarItem <SidebarItem
@ -211,3 +204,20 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
</SidebarSection> </SidebarSection>
); );
} }
function EdgeUpdatesSidebarItem() {
const settingsQuery = usePublicSettings();
if (!isBE || !settingsQuery.data?.EnableEdgeComputeFeatures) {
return null;
}
return (
<SidebarItem
to="portainer.endpoints.updateSchedules"
label="Update & Rollback"
isSubMenu
data-cy="portainerSidebar-updateSchedules"
/>
);
}