1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(sidebar): update menu structure [EE-5666] (#10418)

This commit is contained in:
Ali 2023-10-09 19:23:12 +01:00 committed by GitHub
parent b468070945
commit a0dbabcc5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 519 additions and 146 deletions

View file

@ -13,6 +13,7 @@ import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { SidebarItem } from './SidebarItem';
import { SidebarSection } from './SidebarSection';
import { SidebarParent } from './SidebarItem/SidebarParent';
interface Props {
isAdmin: boolean;
@ -30,15 +31,23 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
return (
<SidebarSection title="Settings">
{showUsersSection && (
<SidebarItem
to="portainer.users"
label="Users"
<SidebarParent
label="User-related"
icon={Users}
data-cy="portainerSidebar-users"
to="portainer.users"
pathOptions={{ includePaths: ['portainer.teams', 'portainer.roles'] }}
data-cy="portainerSidebar-userRelated"
>
<SidebarItem
to="portainer.users"
label="Users"
isSubMenu
data-cy="portainerSidebar-users"
/>
<SidebarItem
to="portainer.teams"
label="Teams"
isSubMenu
data-cy="portainerSidebar-teams"
/>
@ -46,38 +55,56 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
<SidebarItem
to="portainer.roles"
label="Roles"
isSubMenu
data-cy="portainerSidebar-roles"
/>
)}
</SidebarItem>
</SidebarParent>
)}
{isAdmin && (
<>
<SidebarItem
label="Environments"
to="portainer.endpoints"
<SidebarParent
label="Environment-related"
icon={HardDrive}
openOnPaths={['portainer.wizard.endpoints']}
data-cy="portainerSidebar-environments"
to="portainer.endpoints"
pathOptions={{
includePaths: [
'portainer.wizard.endpoints',
'portainer.groups',
'portainer.tags',
],
}}
data-cy="k8sSidebar-networking"
>
<SidebarItem
label="Environments"
to="portainer.endpoints"
ignorePaths={['portainer.endpoints.updateSchedules']}
includePaths={['portainer.wizard.endpoints']}
isSubMenu
data-cy="portainerSidebar-environments"
/>
<SidebarItem
to="portainer.groups"
label="Groups"
isSubMenu
data-cy="portainerSidebar-environmentGroups"
/>
<SidebarItem
to="portainer.tags"
label="Tags"
isSubMenu
data-cy="portainerSidebar-environmentTags"
/>
{isBE && (
<SidebarItem
to="portainer.endpoints.updateSchedules"
label="Update & Rollback"
isSubMenu
data-cy="portainerSidebar-updateSchedules"
/>
)}
</SidebarItem>
</SidebarParent>
<SidebarItem
label="Registries"
@ -95,18 +122,28 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
/>
)}
<SidebarItem
label="Authentication logs"
<SidebarParent
label="Logs"
to="portainer.authLogs"
icon={FileText}
data-cy="portainerSidebar-authLogs"
pathOptions={{
includePaths: ['portainer.activityLogs'],
}}
data-cy="k8sSidebar-logs"
>
<SidebarItem
label="Authentication"
to="portainer.authLogs"
isSubMenu
data-cy="portainerSidebar-authLogs"
/>
<SidebarItem
to="portainer.activityLogs"
label="Activity Logs"
label="Activity"
isSubMenu
data-cy="portainerSidebar-activityLogs"
/>
</SidebarItem>
</SidebarParent>
</>
)}
<SidebarItem
@ -116,29 +153,42 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
data-cy="portainerSidebar-notifications"
/>
{isAdmin && (
<SidebarItem
<SidebarParent
to="portainer.settings"
label="Settings"
icon={Settings}
data-cy="portainerSidebar-settings"
>
<SidebarItem
to="portainer.settings"
label="General"
isSubMenu
ignorePaths={[
'portainer.settings.authentication',
'portainer.settings.edgeCompute',
]}
data-cy="portainerSidebar-generalSettings"
/>
{!window.ddExtension && (
<SidebarItem
to="portainer.settings.authentication"
label="Authentication"
isSubMenu
data-cy="portainerSidebar-authentication"
/>
)}
{isBE && (
<SidebarItem
to="portainer.settings.cloud"
label="Cloud"
to="portainer.settings.sharedcredentials"
label="Shared Credentials"
isSubMenu
data-cy="portainerSidebar-cloud"
/>
)}
<SidebarItem
to="portainer.settings.edgeCompute"
label="Edge Compute"
isSubMenu
data-cy="portainerSidebar-edgeCompute"
/>
@ -151,12 +201,12 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
}
target="_blank"
rel="noreferrer"
className="flex h-8 items-center rounded px-3"
className="hover:!underline focus:no-underline text-sm flex h-8 w-full items-center rounded px-3 transition-colors duration-200 hover:bg-blue-5/20 be:hover:bg-gray-5/20 th-dark:hover:bg-gray-true-5/20"
>
Help / About
</a>
</SidebarItem.Wrapper>
</SidebarItem>
</SidebarParent>
)}
</SidebarSection>
);