From 459742556b931c4c16bb36681996438ade043670 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 29 Sep 2020 10:58:16 +0300 Subject: [PATCH] Fix CRD conditions rendering (#994) * Using reason field if no type provided Signed-off-by: Alex Andreev * Lowecasing condition badge class Signed-off-by: Alex Andreev --- src/renderer/api/endpoints/crd.api.ts | 2 +- .../+custom-resources/crd-resource-details.tsx | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/renderer/api/endpoints/crd.api.ts b/src/renderer/api/endpoints/crd.api.ts index 2a029e6f9d..444d59497d 100644 --- a/src/renderer/api/endpoints/crd.api.ts +++ b/src/renderer/api/endpoints/crd.api.ts @@ -50,7 +50,7 @@ export class CustomResourceDefinition extends KubeObject { message: string; reason: string; status: string; - type: string; + type?: string; }[]; acceptedNames: { plural: string; diff --git a/src/renderer/components/+custom-resources/crd-resource-details.tsx b/src/renderer/components/+custom-resources/crd-resource-details.tsx index 201d5e6e4a..ac64bea683 100644 --- a/src/renderer/components/+custom-resources/crd-resource-details.tsx +++ b/src/renderer/components/+custom-resources/crd-resource-details.tsx @@ -13,8 +13,9 @@ import { apiManager } from "../../api/api-manager"; import { crdStore } from "./crd.store"; import { KubeObjectMeta } from "../kube-object/kube-object-meta"; import { Input } from "../input"; +import { CustomResourceDefinition } from "../../api/endpoints/crd.api"; -interface Props extends KubeObjectDetailsProps { +interface Props extends KubeObjectDetailsProps { } function CrdColumnValue({ value }: { value: any[] | {} | string }) { @@ -66,12 +67,14 @@ export class CrdResourceDetails extends React.Component { })} {showStatus && ( Status} className="status" labelsOnly> - {object.status.conditions.map((condition: { type: string; message: string; status: string }) => { - const { type, message, status } = condition; + {object.status.conditions.map((condition, index) => { + const { type, reason, message, status } = condition; + const kind = type || reason; + if (!kind) return null; return ( );