feat: display NodePort information in Service table
This commit is contained in:
@@ -318,7 +318,7 @@ export default function K8sResourceList() {
|
|||||||
case 'statefulset':
|
case 'statefulset':
|
||||||
return ['Name', 'Namespace', 'Replicas', 'Age', 'Actions']
|
return ['Name', 'Namespace', 'Replicas', 'Age', 'Actions']
|
||||||
case 'service':
|
case 'service':
|
||||||
return ['Name', 'Namespace', 'Type', 'Cluster IP', 'External IP', 'Ports', 'Age', 'Actions']
|
return ['Name', 'Namespace', 'Type', 'Cluster IP', 'External IP', 'Ports', 'NodePort', 'Age', 'Actions']
|
||||||
case 'configmap':
|
case 'configmap':
|
||||||
return ['Name', 'Namespace', 'Data Keys', 'Age', 'Actions']
|
return ['Name', 'Namespace', 'Data Keys', 'Age', 'Actions']
|
||||||
case 'pod':
|
case 'pod':
|
||||||
@@ -385,6 +385,17 @@ export default function K8sResourceList() {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
)
|
)
|
||||||
case 'service':
|
case 'service':
|
||||||
|
// Format ports display
|
||||||
|
let portsDisplay = '-';
|
||||||
|
let nodePortsDisplay = '-';
|
||||||
|
if (spec.ports && spec.ports.length > 0) {
|
||||||
|
portsDisplay = spec.ports.map((p: any) => `${p.port}/${p.protocol}`).join(', ');
|
||||||
|
const nodePorts = spec.ports.filter((p: any) => p.nodePort).map((p: any) => p.nodePort);
|
||||||
|
if (nodePorts.length > 0) {
|
||||||
|
nodePortsDisplay = nodePorts.join(', ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={metadata.uid}>
|
<TableRow key={metadata.uid}>
|
||||||
<TableCell>{metadata.name || '-'}</TableCell>
|
<TableCell>{metadata.name || '-'}</TableCell>
|
||||||
@@ -392,7 +403,8 @@ export default function K8sResourceList() {
|
|||||||
<TableCell>{spec.type || '-'}</TableCell>
|
<TableCell>{spec.type || '-'}</TableCell>
|
||||||
<TableCell>{spec.clusterIP || '-'}</TableCell>
|
<TableCell>{spec.clusterIP || '-'}</TableCell>
|
||||||
<TableCell>{spec.externalIPs?.join(', ') || status.loadBalancer?.ingress?.map((i: any) => i.ip || i.hostname).join(', ') || '-'}</TableCell>
|
<TableCell>{spec.externalIPs?.join(', ') || status.loadBalancer?.ingress?.map((i: any) => i.ip || i.hostname).join(', ') || '-'}</TableCell>
|
||||||
<TableCell>{spec.ports?.map((p: any) => `${p.port}/${p.protocol}`).join(', ') || '-'}</TableCell>
|
<TableCell>{portsDisplay}</TableCell>
|
||||||
|
<TableCell>{nodePortsDisplay}</TableCell>
|
||||||
<TableCell>{getAge(metadata.creationTimestamp)}</TableCell>
|
<TableCell>{getAge(metadata.creationTimestamp)}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Tooltip title="编辑">
|
<Tooltip title="编辑">
|
||||||
|
|||||||
Reference in New Issue
Block a user