1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

fix(kubernetes): create proxied kubeclient EE-4326 (#7850)

This commit is contained in:
Dakota Walsh 2022-10-18 10:46:27 +13:00 committed by GitHub
parent f6d6be90e4
commit 0c995ae1c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 485 additions and 71 deletions

View file

@ -3,7 +3,7 @@ import { useRouter } from '@uirouter/react';
import { useEnvironmentId } from '@/portainer/hooks/useEnvironmentId';
import { useNamespaces } from '@/react/kubernetes/namespaces/queries';
import { Authorized } from '@/portainer/hooks/useUser';
import { useAuthorizations, Authorized } from '@/portainer/hooks/useUser';
import { confirmDeletionAsync } from '@/portainer/services/modal.service/confirm';
import { Datatable } from '@@/datatables';
@ -55,6 +55,7 @@ export function IngressDataTable() {
}}
getRowId={(row) => row.Name + row.Type + row.Namespace}
renderTableActions={tableActions}
disableSelect={useCheckboxes()}
/>
);
@ -80,7 +81,7 @@ export function IngressDataTable() {
</Button>
</Authorized>
<Authorized authorizations="K8sIngressesAdd">
<Authorized authorizations="K8sIngressesW">
<Link to="kubernetes.ingresses.create" className="space-left">
<Button
icon={Plus}
@ -91,7 +92,7 @@ export function IngressDataTable() {
</Button>
</Link>
</Authorized>
<Authorized authorizations="K8sApplicationsW">
<Authorized authorizations="K8sIngressesW">
<Link to="kubernetes.deploy" className="space-left">
<Button icon={Plus} className="btn-wrapper">
Create from manifest
@ -102,6 +103,10 @@ export function IngressDataTable() {
);
}
function useCheckboxes() {
return !useAuthorizations(['K8sIngressesW']);
}
async function handleRemoveClick(ingresses: SelectedIngress[]) {
const confirmed = await confirmDeletionAsync(
'Are you sure you want to delete the selected ingresses?'

View file

@ -1,5 +1,7 @@
import { CellProps, Column } from 'react-table';
import { Authorized } from '@/portainer/hooks/useUser';
import { Link } from '@@/Link';
import { Ingress } from '../../types';
@ -8,17 +10,22 @@ export const name: Column<Ingress> = {
Header: 'Name',
accessor: 'Name',
Cell: ({ row }: CellProps<Ingress>) => (
<Link
to="kubernetes.ingresses.edit"
params={{
uid: row.original.UID,
namespace: row.original.Namespace,
name: row.original.Name,
}}
title={row.original.Name}
<Authorized
authorizations="K8sIngressesW"
childrenUnauthorized={row.original.Name}
>
{row.original.Name}
</Link>
<Link
to="kubernetes.ingresses.edit"
params={{
uid: row.original.UID,
namespace: row.original.Namespace,
name: row.original.Name,
}}
title={row.original.Name}
>
{row.original.Name}
</Link>
</Authorized>
),
id: 'name',
disableFilters: true,