mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
feat(ingress): autodetect ingress controllers EE-673 (#7712)
This commit is contained in:
parent
c96551e410
commit
89eda13eb3
48 changed files with 1252 additions and 1047 deletions
|
@ -0,0 +1,27 @@
|
|||
import { CellProps, Column } from 'react-table';
|
||||
|
||||
import { Badge } from '@@/Badge';
|
||||
import { Icon } from '@@/Icon';
|
||||
|
||||
import type { IngressControllerClassMap } from '../../types';
|
||||
|
||||
export const availability: Column<IngressControllerClassMap> = {
|
||||
Header: 'Availability',
|
||||
accessor: 'Availability',
|
||||
Cell: AvailailityCell,
|
||||
id: 'availability',
|
||||
disableFilters: true,
|
||||
canHide: true,
|
||||
sortInverted: true,
|
||||
sortType: 'basic',
|
||||
Filter: () => null,
|
||||
};
|
||||
|
||||
function AvailailityCell({ value }: CellProps<IngressControllerClassMap>) {
|
||||
return (
|
||||
<Badge type={value ? 'success' : 'danger'}>
|
||||
<Icon icon={value ? 'check' : 'x'} feather className="!mr-1" />
|
||||
{value ? 'Allowed' : 'Disallowed'}
|
||||
</Badge>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
import { useMemo } from 'react';
|
||||
|
||||
import { availability } from './availability';
|
||||
import { type } from './type';
|
||||
import { name } from './name';
|
||||
|
||||
export function useColumns() {
|
||||
return useMemo(() => [name, type, availability], []);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { CellProps, Column } from 'react-table';
|
||||
|
||||
import { Badge } from '@@/Badge';
|
||||
|
||||
import type { IngressControllerClassMap } from '../../types';
|
||||
|
||||
export const name: Column<IngressControllerClassMap> = {
|
||||
Header: 'Ingress class',
|
||||
accessor: 'ClassName',
|
||||
Cell: NameCell,
|
||||
id: 'name',
|
||||
disableFilters: true,
|
||||
canHide: true,
|
||||
Filter: () => null,
|
||||
sortType: 'string',
|
||||
};
|
||||
|
||||
function NameCell({ row }: CellProps<IngressControllerClassMap>) {
|
||||
return (
|
||||
<span className="flex flex-nowrap">
|
||||
{row.original.ClassName}
|
||||
{row.original.New && <Badge className="ml-1">Newly detected</Badge>}
|
||||
</span>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { CellProps, Column } from 'react-table';
|
||||
|
||||
import type { IngressControllerClassMap } from '../../types';
|
||||
|
||||
export const type: Column<IngressControllerClassMap> = {
|
||||
Header: 'Ingress controller type',
|
||||
accessor: 'Type',
|
||||
Cell: ({ row }: CellProps<IngressControllerClassMap>) =>
|
||||
row.original.Type || '-',
|
||||
id: 'type',
|
||||
disableFilters: true,
|
||||
canHide: true,
|
||||
Filter: () => null,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue