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

refactor(containers): replace containers datatable with react component [EE-1815] (#6059)

This commit is contained in:
Chaim Lev-Ari 2022-01-04 14:16:09 +02:00 committed by GitHub
parent 65821aaccc
commit 07e7fbd270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 3614 additions and 1084 deletions

View file

@ -0,0 +1,41 @@
import { Column } from 'react-table';
import _ from 'lodash-es';
import { useEnvironment } from '@/portainer/environments/useEnvironment';
import type { DockerContainer, Port } from '@/docker/containers/types';
export const ports: Column<DockerContainer> = {
Header: 'Published Ports',
accessor: 'Ports',
id: 'ports',
Cell: PortsCell,
disableSortBy: true,
disableFilters: true,
canHide: true,
Filter: () => null,
};
interface Props {
value: Port[];
}
function PortsCell({ value: ports }: Props) {
const { PublicURL: publicUrl } = useEnvironment();
if (ports.length === 0) {
return '-';
}
return _.uniqBy(ports, 'public').map((port) => (
<a
key={`${port.host}:${port.public}`}
className="image-tag"
href={`http://${publicUrl || port.host}:${port.public}`}
target="_blank"
rel="noreferrer"
>
<i className="fa fa-external-link-alt" aria-hidden="true" />
{port.public}:{port.private}
</a>
));
}