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
data-cy="portainerSidebar-environmentTags"
/>
{isBE && (
<SidebarItem
to="portainer.endpoints.updateSchedules"
label="Update & Rollback"
isSubMenu
data-cy="portainerSidebar-updateSchedules"
/>
)}
<EdgeUpdatesSidebarItem />
</SidebarParent>
<SidebarItem
@ -211,3 +204,20 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
</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"
/>
);
}