import "./service-details.scss" import React from "react"; import { observer } from "mobx-react"; import { t, Trans } from "@lingui/macro"; import { DrawerItem, DrawerTitle } from "../drawer"; import { Badge } from "../badge"; import { KubeEventDetails } from "../+events/kube-event-details"; import { KubeObjectDetailsProps } from "../kube-object"; import { Service, serviceApi, endpointApi } from "../../api/endpoints"; import { _i18n } from "../../i18n"; import { apiManager } from "../../api/api-manager"; import { KubeObjectMeta } from "../kube-object/kube-object-meta"; import { ServicePorts } from "./service-ports"; import { endpointStore } from "../+network-endpoints/endpoints.store"; import { ServiceDetailsEndpoint } from "./service-details-endpoint"; interface Props extends KubeObjectDetailsProps { } @observer export class ServiceDetails extends React.Component { componentDidMount() { if (!endpointStore.isLoaded) { endpointStore.loadAll(); } endpointApi.watch() } render() { const { object: service } = this.props; if (!service) return; const { spec } = service; const endpoint = endpointStore.getByName(service.getName(), service.getNs()) return (
Selector} labelsOnly> {service.getSelector().map(selector => )} Type}> {spec.type} Session Affinity}> {spec.sessionAffinity} Cluster IP}> {spec.clusterIP} {service.getExternalIps().length > 0 && ( External IPs}> {service.getExternalIps().map(ip =>
{ip}
)}
)} Ports}> {spec.type === "LoadBalancer" && spec.loadBalancerIP && ( Load Balancer IP}> {spec.loadBalancerIP} )}
); } } apiManager.registerViews(serviceApi, { Details: ServiceDetails, })