1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+network-endpoints/endpoint-details.tsx
Sebastian Malton c65a1f3f61 Enforce some naming conventions (#4813)
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
2022-03-03 14:40:53 +01:00

48 lines
1.3 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import "./endpoint-details.scss";
import React from "react";
import { observer } from "mobx-react";
import { DrawerTitle } from "../drawer";
import type { KubeObjectDetailsProps } from "../kube-object-details";
import { Endpoint } from "../../../common/k8s-api/endpoints";
import { KubeObjectMeta } from "../kube-object-meta";
import { EndpointSubsetList } from "./endpoint-subset-list";
import logger from "../../../common/logger";
export interface EndpointDetailsProps extends KubeObjectDetailsProps<Endpoint> {
}
@observer
export class EndpointDetails extends React.Component<EndpointDetailsProps> {
render() {
const { object: endpoint } = this.props;
if (!endpoint) {
return null;
}
if (!(endpoint instanceof Endpoint)) {
logger.error("[EndpointDetails]: passed object that is not an instanceof Endpoint", endpoint);
return null;
}
return (
<div className="EndpointDetails">
<KubeObjectMeta object={endpoint}/>
<DrawerTitle title="Subsets"/>
{
endpoint.getEndpointSubsets().map((subset) => (
<EndpointSubsetList key={subset.toString()} subset={subset} endpoint={endpoint} />
))
}
</div>
);
}
}