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';
|
2023-10-09 18:23:12 +00:00
|
|
|
import { SidebarParent } from './SidebarItem/SidebarParent';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
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 (
|
2023-10-11 18:32:52 +00:00
|
|
|
<SidebarSection title="Administration">
|
2022-06-23 07:25:56 +00:00
|
|
|
{showUsersSection && (
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
|
|
|
label="User-related"
|
2022-06-28 16:36:40 +00:00
|
|
|
icon={Users}
|
2023-10-09 18:23:12 +00:00
|
|
|
to="portainer.users"
|
|
|
|
pathOptions={{ includePaths: ['portainer.teams', 'portainer.roles'] }}
|
|
|
|
data-cy="portainerSidebar-userRelated"
|
2022-06-28 16:36:40 +00:00
|
|
|
>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.users"
|
|
|
|
label="Users"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="portainerSidebar-users"
|
|
|
|
/>
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.teams"
|
|
|
|
label="Teams"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
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"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-roles"
|
|
|
|
/>
|
|
|
|
)}
|
2023-10-09 18:23:12 +00:00
|
|
|
</SidebarParent>
|
2022-06-23 07:25:56 +00:00
|
|
|
)}
|
|
|
|
{isAdmin && (
|
|
|
|
<>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
|
|
|
label="Environment-related"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={HardDrive}
|
2023-10-09 18:23:12 +00:00
|
|
|
to="portainer.endpoints"
|
|
|
|
pathOptions={{
|
|
|
|
includePaths: [
|
|
|
|
'portainer.wizard.endpoints',
|
|
|
|
'portainer.groups',
|
|
|
|
'portainer.tags',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
data-cy="k8sSidebar-networking"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
label="Environments"
|
|
|
|
to="portainer.endpoints"
|
|
|
|
ignorePaths={['portainer.endpoints.updateSchedules']}
|
|
|
|
includePaths={['portainer.wizard.endpoints']}
|
|
|
|
isSubMenu
|
|
|
|
data-cy="portainerSidebar-environments"
|
|
|
|
/>
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.groups"
|
|
|
|
label="Groups"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-environmentGroups"
|
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.tags"
|
|
|
|
label="Tags"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-environmentTags"
|
|
|
|
/>
|
2023-11-05 10:45:56 +00:00
|
|
|
<EdgeUpdatesSidebarItem />
|
2023-10-09 18:23:12 +00:00
|
|
|
</SidebarParent>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
<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
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
|
|
|
label="Logs"
|
2022-06-23 07:25:56 +00:00
|
|
|
to="portainer.authLogs"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={FileText}
|
2023-10-09 18:23:12 +00:00
|
|
|
pathOptions={{
|
|
|
|
includePaths: ['portainer.activityLogs'],
|
|
|
|
}}
|
|
|
|
data-cy="k8sSidebar-logs"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
label="Authentication"
|
|
|
|
to="portainer.authLogs"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="portainerSidebar-authLogs"
|
|
|
|
/>
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.activityLogs"
|
2023-10-09 18:23:12 +00:00
|
|
|
label="Activity"
|
|
|
|
isSubMenu
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-activityLogs"
|
|
|
|
/>
|
2023-10-09 18:23:12 +00:00
|
|
|
</SidebarParent>
|
2022-09-23 05:17:44 +00:00
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.notifications"
|
|
|
|
icon={Bell}
|
|
|
|
label="Notifications"
|
|
|
|
data-cy="portainerSidebar-notifications"
|
|
|
|
/>
|
|
|
|
{isAdmin && (
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarParent
|
2022-09-23 05:17:44 +00:00
|
|
|
to="portainer.settings"
|
|
|
|
label="Settings"
|
|
|
|
icon={Settings}
|
|
|
|
data-cy="portainerSidebar-settings"
|
|
|
|
>
|
2023-10-09 18:23:12 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="portainer.settings"
|
|
|
|
label="General"
|
|
|
|
isSubMenu
|
|
|
|
ignorePaths={[
|
|
|
|
'portainer.settings.authentication',
|
|
|
|
'portainer.settings.edgeCompute',
|
|
|
|
]}
|
|
|
|
data-cy="portainerSidebar-generalSettings"
|
|
|
|
/>
|
2022-09-23 05:17:44 +00:00
|
|
|
{!window.ddExtension && (
|
|
|
|
<SidebarItem
|
|
|
|
to="portainer.settings.authentication"
|
|
|
|
label="Authentication"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-09-23 05:17:44 +00:00
|
|
|
data-cy="portainerSidebar-authentication"
|
|
|
|
/>
|
|
|
|
)}
|
2022-12-01 06:40:52 +00:00
|
|
|
{isBE && (
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2023-10-09 18:23:12 +00:00
|
|
|
to="portainer.settings.sharedcredentials"
|
|
|
|
label="Shared Credentials"
|
|
|
|
isSubMenu
|
2022-09-23 05:17:44 +00:00
|
|
|
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"
|
2023-10-09 18:23:12 +00:00
|
|
|
isSubMenu
|
2022-09-23 05:17:44 +00:00
|
|
|
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-10-09 18:23:12 +00:00
|
|
|
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"
|
2022-09-23 05:17:44 +00:00
|
|
|
>
|
|
|
|
Help / About
|
|
|
|
</a>
|
|
|
|
</SidebarItem.Wrapper>
|
2023-10-09 18:23:12 +00:00
|
|
|
</SidebarParent>
|
2022-06-23 07:25:56 +00:00
|
|
|
)}
|
|
|
|
</SidebarSection>
|
|
|
|
);
|
|
|
|
}
|
2023-11-05 10:45:56 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|