Fix CRD conditions rendering (#994)

* Using reason field if no type provided

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Lowecasing condition badge class

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2020-09-29 10:58:16 +03:00
1 parent 34e141e517
commit 459742556b
2 files changed
+9 -6

No files matched your search

+1 -1
View File
@@ -50,7 +50,7 @@ export class CustomResourceDefinition extends KubeObject {
message: string;
reason: string;
status: string;
type: string;
type?: string;
}[];
acceptedNames: {
plural: string;
@@ -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<CustomResourceDefinition> {
}
function CrdColumnValue({ value }: { value: any[] | {} | string }) {
@@ -66,12 +67,14 @@ export class CrdResourceDetails extends React.Component<Props> {
})}
{showStatus && (
<DrawerItem name={<Trans>Status</Trans>} 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 (
<Badge
key={type} label={type}
className={cssNames({ disabled: status === "False" }, type.toLowerCase())}
key={kind + index} label={kind}
className={cssNames({ disabled: status === "False" }, kind.toLowerCase())}
tooltip={message}
/>
);