/** * Copyright (c) 2021 OpenLens Authors * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import "./crd-details.scss"; import React from "react"; import { Link } from "react-router-dom"; import { observer } from "mobx-react"; import type { CustomResourceDefinition } from "../../api/endpoints/crd.api"; import { cssNames } from "../../utils"; import { AceEditor } from "../ace-editor"; import { Badge } from "../badge"; import { DrawerItem, DrawerTitle } from "../drawer"; import type { KubeObjectDetailsProps } from "../kube-object"; import { Table, TableCell, TableHead, TableRow } from "../table"; import { Input } from "../input"; import { KubeObjectMeta } from "../kube-object/kube-object-meta"; import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry"; interface Props extends KubeObjectDetailsProps { } @observer export class CRDDetails extends React.Component { render() { const { object: crd } = this.props; if (!crd) return null; const { plural, singular, kind, listKind } = crd.getNames(); const printerColumns = crd.getPrinterColumns(); const validation = crd.getValidation(); return (
{crd.getGroup()} {crd.getVersion()} {crd.getStoredVersions()} {crd.getScope()} {crd.getResourceTitle()} { crd.getConditions().map(condition => { const { type, message, lastTransitionTime, status } = condition; return (

{message}

Last transition time: {lastTransitionTime}

)} /> ); }) }
plural singular kind listKind {plural} {singular} {kind} {listKind}
{printerColumns.length > 0 && <> Name Type JSON Path { printerColumns.map((column, index) => { const { name, type, jsonPath } = column; return ( {name} {type} ); }) }
} {validation && <> }
); } } kubeObjectDetailRegistry.add({ kind: "CustomResourceDefinition", apiVersions: ["apiextensions.k8s.io/v1", "apiextensions.k8s.io/v1beta1"], components: { Details: (props) => } });