mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 23:39:41 +02:00
39 lines
835 B
TypeScript
39 lines
835 B
TypeScript
|
import { CellContext } from '@tanstack/react-table';
|
||
|
|
||
|
import { ServiceRowData } from '../types';
|
||
|
|
||
|
import { columnHelper } from './helper';
|
||
|
|
||
|
export const externalHost = columnHelper.accessor(
|
||
|
(row) => {
|
||
|
if (row.Type === 'ExternalName') {
|
||
|
return row.ExternalName || '-';
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
row.IngressStatus?.map((status) => status.Hostname)
|
||
|
.filter(Boolean)
|
||
|
.join(' ,') || '-'
|
||
|
);
|
||
|
},
|
||
|
{
|
||
|
header: 'External Host',
|
||
|
id: 'externalHost',
|
||
|
cell: Cell,
|
||
|
}
|
||
|
);
|
||
|
|
||
|
function Cell({ row }: CellContext<ServiceRowData, string>) {
|
||
|
if (row.original.Type === 'ExternalName') {
|
||
|
return <div>{row.original.ExternalName || '-'}</div>;
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<div>
|
||
|
{row.original.IngressStatus?.map((status) => status.Hostname)
|
||
|
.filter(Boolean)
|
||
|
.join(' ,') || '-'}
|
||
|
</div>
|
||
|
);
|
||
|
}
|