2022-06-28 07:42:42 +00:00
|
|
|
import { Box, Edit, Layers, Loader, Lock, Server } from 'react-feather';
|
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
import { EnvironmentId } from '@/portainer/environments/types';
|
|
|
|
import { Authorized } from '@/portainer/hooks/useUser';
|
|
|
|
|
2022-06-28 07:42:42 +00:00
|
|
|
import { DashboardLink } from '../items/DashboardLink';
|
2022-06-23 07:25:56 +00:00
|
|
|
import { SidebarItem } from '../SidebarItem';
|
2022-06-28 07:42:42 +00:00
|
|
|
import { VolumesLink } from '../items/VolumesLink';
|
|
|
|
import { useSidebarState } from '../useSidebarState';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
import { KubectlShellButton } from './KubectlShell';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
environmentId: EnvironmentId;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function KubernetesSidebar({ environmentId }: Props) {
|
2022-06-28 07:42:42 +00:00
|
|
|
const { isOpen } = useSidebarState();
|
|
|
|
|
2022-06-23 07:25:56 +00:00
|
|
|
return (
|
|
|
|
<>
|
2022-07-06 05:09:14 +00:00
|
|
|
{isOpen && (
|
|
|
|
<div className="mb-3">
|
|
|
|
<KubectlShellButton environmentId={environmentId} />
|
|
|
|
</div>
|
|
|
|
)}
|
2022-06-23 07:25:56 +00:00
|
|
|
|
2022-06-28 16:36:40 +00:00
|
|
|
<DashboardLink
|
|
|
|
environmentId={environmentId}
|
|
|
|
platformPath="kubernetes"
|
|
|
|
data-cy="k8sSidebar-dashboard"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.templates.custom"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Edit}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Custom Templates"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-customTemplates"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.resourcePools"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Layers}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Namespaces"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-namespaces"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
2022-07-22 02:14:31 +00:00
|
|
|
<Authorized
|
|
|
|
authorizations="HelmInstallChart"
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.templates.helm"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Loader}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Helm"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-helm"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.applications"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Box}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="Applications"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-applications"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.configurations"
|
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Lock}
|
2022-06-23 07:25:56 +00:00
|
|
|
label="ConfigMaps & Secrets"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-configurations"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
|
2022-06-28 16:36:40 +00:00
|
|
|
<VolumesLink
|
|
|
|
environmentId={environmentId}
|
|
|
|
platformPath="kubernetes"
|
|
|
|
data-cy="k8sSidebar-volumes"
|
|
|
|
/>
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
label="Cluster"
|
|
|
|
to="kubernetes.cluster"
|
2022-06-28 07:42:42 +00:00
|
|
|
icon={Server}
|
2022-06-23 07:25:56 +00:00
|
|
|
params={{ endpointId: environmentId }}
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-cluster"
|
2022-06-23 07:25:56 +00:00
|
|
|
>
|
2022-07-22 02:14:31 +00:00
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterSetupRW"
|
|
|
|
adminOnlyCE
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2022-07-22 02:14:31 +00:00
|
|
|
to="kubernetes.cluster.setup"
|
2022-06-23 07:25:56 +00:00
|
|
|
params={{ id: environmentId }}
|
|
|
|
label="Setup"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-setup"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
|
2022-07-22 02:14:31 +00:00
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterSetupRW"
|
|
|
|
adminOnlyCE
|
|
|
|
environmentId={environmentId}
|
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<SidebarItem
|
2022-07-22 02:14:31 +00:00
|
|
|
to="kubernetes.cluster.securityConstraint"
|
2022-06-23 07:25:56 +00:00
|
|
|
params={{ id: environmentId }}
|
|
|
|
label="Security constraints"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-securityConstraints"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</Authorized>
|
|
|
|
|
|
|
|
<SidebarItem
|
|
|
|
to="kubernetes.registries"
|
|
|
|
params={{ endpointId: environmentId }}
|
|
|
|
label="Registries"
|
2022-06-28 16:36:40 +00:00
|
|
|
data-cy="k8sSidebar-registries"
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
|
|
|
</SidebarItem>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|