2023-11-14 12:54:44 +00:00
|
|
|
import { Box, Clock, LayoutGrid, Layers, Puzzle, Edit } from 'lucide-react';
|
2022-06-28 07:42:42 +00:00
|
|
|
|
2022-12-20 21:07:34 +00:00
|
|
|
import { isBE } from '../portainer/feature-flags/feature-flags.service';
|
2023-10-05 07:31:08 +00:00
|
|
|
import { useSettings } from '../portainer/settings/queries';
|
2022-12-20 21:07:34 +00:00
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
import { SidebarItem } from './SidebarItem';
|
|
|
|
import { SidebarSection } from './SidebarSection';
|
2023-11-14 12:54:44 +00:00
|
|
|
import { SidebarParent } from './SidebarItem/SidebarParent';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
export function EdgeComputeSidebar() {
|
2023-10-05 07:31:08 +00:00
|
|
|
// this sidebar is rendered only for admins, so we can safely assume that settingsQuery will succeed
|
|
|
|
const settingsQuery = useSettings();
|
|
|
|
|
|
|
|
if (!settingsQuery.data || !settingsQuery.data.EnableEdgeComputeFeatures) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const settings = settingsQuery.data;
|
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
return (
|
|
|
|
<SidebarSection title="Edge compute">
|
2022-06-28 16:36:40 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="edge.groups"
|
|
|
|
label="Edge Groups"
|
2022-11-28 02:00:28 +00:00
|
|
|
icon={LayoutGrid}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="portainerSidebar-edgeGroups"
|
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
to="edge.stacks"
|
|
|
|
label="Edge Stacks"
|
|
|
|
icon={Layers}
|
|
|
|
data-cy="portainerSidebar-edgeStacks"
|
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
to="edge.jobs"
|
|
|
|
label="Edge Jobs"
|
|
|
|
icon={Clock}
|
|
|
|
data-cy="portainerSidebar-edgeJobs"
|
|
|
|
/>
|
2022-12-20 21:07:34 +00:00
|
|
|
{isBE && (
|
2023-10-05 07:31:08 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="edge.configurations"
|
|
|
|
label="Edge Configurations"
|
|
|
|
icon={Puzzle}
|
|
|
|
data-cy="portainerSidebar-edgeConfigurations"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{isBE && !settings.TrustOnFirstConnect && (
|
2022-12-20 21:07:34 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="edge.devices.waiting-room"
|
|
|
|
label="Waiting Room"
|
|
|
|
icon={Box}
|
|
|
|
data-cy="portainerSidebar-edgeDevicesWaitingRoom"
|
|
|
|
/>
|
|
|
|
)}
|
2023-11-14 12:54:44 +00:00
|
|
|
<SidebarParent
|
|
|
|
icon={Edit}
|
2023-11-15 08:45:07 +00:00
|
|
|
label="Edge Templates"
|
2023-11-14 12:54:44 +00:00
|
|
|
to="edge.templates"
|
|
|
|
data-cy="edgeSidebar-templates"
|
|
|
|
>
|
|
|
|
<SidebarItem
|
|
|
|
label="Application"
|
|
|
|
to="edge.templates"
|
|
|
|
ignorePaths={['edge.templates.custom']}
|
|
|
|
isSubMenu
|
|
|
|
data-cy="edgeSidebar-appTemplates"
|
|
|
|
/>
|
2023-11-15 08:45:07 +00:00
|
|
|
<SidebarItem
|
2023-11-14 12:54:44 +00:00
|
|
|
label="Custom"
|
|
|
|
to="edge.templates.custom"
|
|
|
|
isSubMenu
|
|
|
|
data-cy="edgeSidebar-customTemplates"
|
2023-11-15 08:45:07 +00:00
|
|
|
/>
|
2023-11-14 12:54:44 +00:00
|
|
|
</SidebarParent>
|
2022-06-23 07:25:56 +00:00
|
|
|
</SidebarSection>
|
|
|
|
);
|
|
|
|
}
|