2022-06-28 07:42:42 +00:00
|
|
|
import {
|
|
|
|
Users,
|
|
|
|
Award,
|
|
|
|
Settings,
|
|
|
|
HardDrive,
|
|
|
|
Radio,
|
|
|
|
FileText,
|
2022-09-23 05:17:44 +00:00
|
|
|
Bell,
|
2022-11-28 02:00:28 +00:00
|
|
|
} from 'lucide-react';
|
2022-06-28 07:42:42 +00:00
|
|
|
|
2022-09-21 06:14:29 +00:00
|
|
|
import { usePublicSettings } from '@/react/portainer/settings/queries';
|
2022-12-01 06:40:52 +00:00
|
|
|
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
import { SidebarItem } from './SidebarItem';
|
|
|
|
import { SidebarSection } from './SidebarSection';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
isAdmin: boolean;
|
2022-08-03 21:23:38 +00:00
|
|
|
isTeamLeader?: boolean;
|
2022-06-23 07:25:56 +00:00
|
|
|
}
|
|
|
|
|
2022-08-03 21:23:38 +00:00
|
|
|
export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) {
|
2022-06-27 16:29:17 +00:00
|
|
|
const teamSyncQuery = usePublicSettings<boolean>({
|
|
|
|
select: (settings) => settings.TeamSync,
|
|
|
|
});
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
const showUsersSection =
|
2022-08-03 21:23:38 +00:00
|
|
|
!window.ddExtension && (isAdmin || (isTeamLeader && !teamSyncQuery.data));
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<SidebarSection title="Settings">
|
|
|
|
{showUsersSection && (
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.users"
|
|
|
|
label="Users"
|
|
|
|
icon={Users}
|
|
|
|
data-cy="portainerSidebar-users"
|
|
|
|
>
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.teams"
|
|
|
|
label="Teams"
|
|
|
|
data-cy="portainerSidebar-teams"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2022-06-28 16:36:40 +00:00
|
|
|
{isAdmin && (
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.roles"
|
|
|
|
label="Roles"
|
|
|
|
data-cy="portainerSidebar-roles"
|
|
|
|
/>
|
|
|
|
)}
|
2022-06-23 07:25:56 +00:00
|
|
|
</SidebarItem>
|
|
|
|
)}
|
|
|
|
{isAdmin && (
|
|
|
|
<>
|
|
|
|
<SidebarItem
|
|
|
|
label="Environments"
|
|
|
|
to="portainer.endpoints"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={HardDrive}
|
2022-06-23 07:25:56 +00:00
|
|
|
openOnPaths={['portainer.wizard.endpoints']}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-environments"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.groups"
|
|
|
|
label="Groups"
|
|
|
|
data-cy="portainerSidebar-environmentGroups"
|
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.tags"
|
|
|
|
label="Tags"
|
|
|
|
data-cy="portainerSidebar-environmentTags"
|
|
|
|
/>
|
2022-12-01 06:40:52 +00:00
|
|
|
{isBE && (
|
2022-09-13 13:56:38 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.endpoints.updateSchedules"
|
|
|
|
label="Update & Rollback"
|
|
|
|
data-cy="portainerSidebar-updateSchedules"
|
|
|
|
/>
|
|
|
|
)}
|
2022-06-23 07:25:56 +00:00
|
|
|
</SidebarItem>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
label="Registries"
|
|
|
|
to="portainer.registries"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Radio}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-registries"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
2022-12-01 06:40:52 +00:00
|
|
|
{isBE && (
|
2022-06-28 07:42:42 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.licenses"
|
|
|
|
label="Licenses"
|
|
|
|
icon={Award}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-licenses"
|
2022-06-28 07:42:42 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
|
|
|
label="Authentication logs"
|
|
|
|
to="portainer.authLogs"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={FileText}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-authLogs"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.activityLogs"
|
|
|
|
label="Activity Logs"
|
|
|
|
data-cy="portainerSidebar-activityLogs"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
</SidebarItem>
|
2022-09-23 05:17:44 +00:00
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.notifications"
|
|
|
|
icon={Bell}
|
|
|
|
label="Notifications"
|
|
|
|
data-cy="portainerSidebar-notifications"
|
|
|
|
/>
|
|
|
|
{isAdmin && (
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.settings"
|
|
|
|
label="Settings"
|
|
|
|
icon={Settings}
|
|
|
|
data-cy="portainerSidebar-settings"
|
|
|
|
>
|
|
|
|
{!window.ddExtension && (
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.settings.authentication"
|
|
|
|
label="Authentication"
|
|
|
|
data-cy="portainerSidebar-authentication"
|
|
|
|
/>
|
|
|
|
)}
|
2022-12-01 06:40:52 +00:00
|
|
|
{isBE && (
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2022-09-23 05:17:44 +00:00
|
|
|
to="portainer.settings.cloud"
|
|
|
|
label="Cloud"
|
|
|
|
data-cy="portainerSidebar-cloud"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
2022-09-23 05:17:44 +00:00
|
|
|
)}
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.settings.edgeCompute"
|
|
|
|
label="Edge Compute"
|
|
|
|
data-cy="portainerSidebar-edgeCompute"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2022-09-23 05:17:44 +00:00
|
|
|
<SidebarItem.Wrapper label="Help / About">
|
|
|
|
<a
|
|
|
|
href={
|
|
|
|
process.env.PORTAINER_EDITION === 'CE'
|
|
|
|
? 'https://www.portainer.io/community_help'
|
|
|
|
: 'https://documentation.portainer.io/r/business-support'
|
|
|
|
}
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
2023-02-12 21:04:24 +00:00
|
|
|
className="flex h-8 items-center rounded px-3"
|
2022-09-23 05:17:44 +00:00
|
|
|
>
|
|
|
|
Help / About
|
|
|
|
</a>
|
|
|
|
</SidebarItem.Wrapper>
|
|
|
|
</SidebarItem>
|
2022-06-23 07:25:56 +00:00
|
|
|
)}
|
|
|
|
</SidebarSection>
|
|
|
|
);
|
|
|
|
}
|