1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Move using externalName to display logic

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-10-29 11:10:46 -04:00
parent a28e4031f2
commit a57ad9d3ad
3 changed files with 27 additions and 18 deletions

View File

@ -108,10 +108,6 @@ export class Service extends KubeObject {
return this.spec.externalIPs; return this.spec.externalIPs;
} }
if (this.spec.externalName) {
return [this.spec.externalName];
}
return []; return [];
} }

View File

@ -67,6 +67,11 @@ export class ServiceDetails extends React.Component<Props> {
const { spec } = service; const { spec } = service;
const endpoint = endpointStore.getByName(service.getName(), service.getNs()); const endpoint = endpointStore.getByName(service.getName(), service.getNs());
const externalIps = service.getExternalIps();
if (externalIps.length === 0 && spec?.externalName) {
externalIps.push(spec.externalName);
}
return ( return (
<div className="ServicesDetails"> <div className="ServicesDetails">
@ -106,9 +111,9 @@ export class ServiceDetails extends React.Component<Props> {
{service.getIpFamilyPolicy()} {service.getIpFamilyPolicy()}
</DrawerItem> </DrawerItem>
{service.getExternalIps().length > 0 && ( {externalIps.length > 0 && (
<DrawerItem name="External IPs"> <DrawerItem name="External IPs">
{service.getExternalIps().map(ip => <div key={ip}>{ip}</div>)} {externalIps.map(ip => <div key={ip}>{ip}</div>)}
</DrawerItem> </DrawerItem>
)} )}

View File

@ -81,18 +81,26 @@ export class Services extends React.Component<Props> {
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age }, { title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status }, { title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
]} ]}
renderTableContents={service => [ renderTableContents={service => {
service.getName(), const externalIps = service.getExternalIps();
<KubeObjectStatusIcon key="icon" object={service} />,
service.getNs(), if (externalIps.length === 0 && service.spec?.externalName) {
service.getType(), externalIps.push(service.spec.externalName);
service.getClusterIp(), }
service.getPorts().join(", "),
service.getExternalIps().join(", ") || "-", return [
service.getSelector().map(label => <Badge key={label} label={label}/>), service.getName(),
service.getAge(), <KubeObjectStatusIcon key="icon" object={service} />,
{ title: service.getStatus(), className: service.getStatus().toLowerCase() }, service.getNs(),
]} service.getType(),
service.getClusterIp(),
service.getPorts().join(", "),
externalIps.join(", ") || "-",
service.getSelector().map(label => <Badge key={label} label={label} />),
service.getAge(),
{ title: service.getStatus(), className: service.getStatus().toLowerCase() },
];
}}
/> />
); );
} }