mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
fix(kube-tables): update table accessor fns [EE-5464] (#8920)
* fix(services): update accessor fns [EE-5464] * small fixes --------- Co-authored-by: testa113 <testa113>
This commit is contained in:
parent
22f4c5d650
commit
42fce1ec57
9 changed files with 148 additions and 108 deletions
|
@ -2,18 +2,21 @@ import { formatDate } from '@/portainer/filters/filters';
|
|||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const created = columnHelper.accessor('CreationDate', {
|
||||
header: 'Created',
|
||||
cell: ({ row, getValue }) => {
|
||||
const date = formatDate(getValue());
|
||||
const owner =
|
||||
row.original.Labels?.['io.portainer.kubernetes.ingress.owner'];
|
||||
|
||||
if (owner) {
|
||||
return `${date} by ${owner}`;
|
||||
}
|
||||
|
||||
return date;
|
||||
export const created = columnHelper.accessor(
|
||||
(row) => {
|
||||
const owner = row.Labels?.['io.portainer.kubernetes.ingress.owner'];
|
||||
const date = formatDate(row.CreationDate);
|
||||
return owner ? `${date} by ${owner}` : date;
|
||||
},
|
||||
id: 'created',
|
||||
});
|
||||
{
|
||||
header: 'Created',
|
||||
cell: ({ row, getValue }) => {
|
||||
const date = formatDate(getValue());
|
||||
const owner =
|
||||
row.original.Labels?.['io.portainer.kubernetes.ingress.owner'];
|
||||
|
||||
return owner ? `${date} by ${owner}` : date;
|
||||
},
|
||||
id: 'created',
|
||||
}
|
||||
);
|
||||
|
|
|
@ -4,18 +4,28 @@ import { AlertTriangle, ArrowRight } from 'lucide-react';
|
|||
import { Icon } from '@@/Icon';
|
||||
import { Badge } from '@@/Badge';
|
||||
|
||||
import { Ingress, TLS, Path } from '../../types';
|
||||
import { Ingress, TLS } from '../../types';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const ingressRules = columnHelper.accessor('Paths', {
|
||||
header: 'Rules and Paths',
|
||||
id: 'ingressRules',
|
||||
cell: Cell,
|
||||
});
|
||||
export const ingressRules = columnHelper.accessor(
|
||||
({ Paths, TLS }) =>
|
||||
// return an accessor function with all the useful text to search for
|
||||
Paths.map((path) => {
|
||||
const isHttp = isHTTP(TLS || [], path.Host);
|
||||
return `${isHttp ? 'http' : 'https'}://${path.Host}${path.Path}${
|
||||
path.ServiceName
|
||||
}:${path.Port} ${!path.HasService && "Service doesn't exist"}`;
|
||||
}).join(','),
|
||||
{
|
||||
header: 'Rules and Paths',
|
||||
id: 'ingressRules',
|
||||
cell: Cell,
|
||||
}
|
||||
);
|
||||
|
||||
function Cell({ row, getValue }: CellContext<Ingress, Path[] | undefined>) {
|
||||
const paths = getValue();
|
||||
function Cell({ row }: CellContext<Ingress, string>) {
|
||||
const paths = row.original.Paths;
|
||||
|
||||
if (!paths) {
|
||||
return <div />;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue