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