fix(docker): search published ports EE-4856 (#8939)

pull/8944/head
Dakota Walsh 2023-05-15 12:26:42 +12:00 committed by GitHub
parent 6ef53f0598
commit 8fa49d47f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 13 deletions

View File

@ -2,8 +2,11 @@ import { isoDateFromTimestamp } from '@/portainer/filters/filters';
import { columnHelper } from './helper';
export const created = columnHelper.accessor('Created', {
header: 'Created',
id: 'created',
cell: ({ getValue }) => isoDateFromTimestamp(getValue()),
});
export const created = columnHelper.accessor(
(row) => isoDateFromTimestamp(row.Created),
{
header: 'Created',
id: 'created',
cell: ({ row }) => isoDateFromTimestamp(row.original.Created),
}
);

View File

@ -2,7 +2,7 @@ import _ from 'lodash';
import { ExternalLink } from 'lucide-react';
import { CellContext } from '@tanstack/react-table';
import type { DockerContainer, Port } from '@/react/docker/containers/types';
import type { DockerContainer } from '@/react/docker/containers/types';
import { Icon } from '@@/Icon';
@ -10,14 +10,20 @@ import { useRowContext } from '../RowContext';
import { columnHelper } from './helper';
export const ports = columnHelper.accessor('Ports', {
header: 'Published Ports',
id: 'ports',
cell: PortsCell,
});
export const ports = columnHelper.accessor(
(row) =>
_.uniqBy(row.Ports, 'public')
.map((port) => `${port.public}:${port.private}`)
.join(','),
{
header: 'Published Ports',
id: 'ports',
cell: Cell,
}
);
function PortsCell({ getValue }: CellContext<DockerContainer, Port[]>) {
const ports = getValue();
function Cell({ row }: CellContext<DockerContainer, string>) {
const ports = row.original.Ports;
const { environment } = useRowContext();