1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat: kubernets service - display external hostname (#486)

This commit is contained in:
Steven Kang 2025-03-12 22:34:00 +13:00 committed by GitHub
parent 28b222fffa
commit 798fa2396a
4 changed files with 45 additions and 5 deletions

View file

@ -0,0 +1,38 @@
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>
);
}

View file

@ -3,6 +3,7 @@ import { type } from './type';
import { namespace } from './namespace';
import { ports } from './ports';
import { clusterIP } from './clusterIP';
import { externalHost } from './externalHost';
import { externalIP } from './externalIP';
import { targetPorts } from './targetPorts';
import { application } from './application';
@ -16,6 +17,7 @@ export const columns = [
ports,
targetPorts,
clusterIP,
externalHost,
externalIP,
created,
];