import "./ingresses.scss" import * as React from "react" import { observer } from "mobx-react"; import { RouteComponentProps } from "react-router-dom" import { IngressRouteParams } from "./ingresses.route" import { Ingress, ingressApi } from "../../api/endpoints/ingress.api" import { ingressStore } from "./ingress.store"; import { KubeObjectMenu, KubeObjectMenuProps } from "../kube-object/kube-object-menu"; import { KubeObjectListLayout } from "../kube-object"; import { Trans } from "@lingui/macro"; import { apiManager } from "../../api/api-manager"; enum sortBy { name = "name", namespace = "namespace", age = "age", } interface Props extends RouteComponentProps { } @observer export class Ingresses extends React.Component { render() { return ( ingress.getName(), [sortBy.namespace]: (ingress: Ingress) => ingress.getNs(), [sortBy.age]: (ingress: Ingress) => ingress.getAge(false), }} searchFilters={[ (ingress: Ingress) => ingress.getSearchFields(), (ingress: Ingress) => ingress.getPorts(), ]} renderHeaderTitle={Ingresses} renderTableHeader={[ { title: Name, className: "name", sortBy: sortBy.name }, { title: Namespace, className: "namespace", sortBy: sortBy.namespace }, { title: Rules, className: "rules" }, { title: Age, className: "age", sortBy: sortBy.age }, ]} renderTableContents={(ingress: Ingress) => [ ingress.getName(), ingress.getNs(), ingress.getRoutes().map(route =>

{route}

), ingress.getAge(), ]} renderItemMenu={(item: Ingress) => { return }} tableProps={{ customRowHeights: (item: Ingress, lineHeight, paddings) => { const lines = item.getRoutes().length || 1; return lines * lineHeight + paddings; } }} /> ) } } export function IngressMenu(props: KubeObjectMenuProps) { return ( ) } apiManager.registerViews(ingressApi, { Menu: IngressMenu })