1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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 2020-09-29 10:58:16 +03:00 committed by GitHub
parent 34e141e517
commit 459742556b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -50,7 +50,7 @@ export class CustomResourceDefinition extends KubeObject {
message: string; message: string;
reason: string; reason: string;
status: string; status: string;
type: string; type?: string;
}[]; }[];
acceptedNames: { acceptedNames: {
plural: string; plural: string;

View File

@ -13,8 +13,9 @@ import { apiManager } from "../../api/api-manager";
import { crdStore } from "./crd.store"; import { crdStore } from "./crd.store";
import { KubeObjectMeta } from "../kube-object/kube-object-meta"; import { KubeObjectMeta } from "../kube-object/kube-object-meta";
import { Input } from "../input"; 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 }) { function CrdColumnValue({ value }: { value: any[] | {} | string }) {
@ -66,12 +67,14 @@ export class CrdResourceDetails extends React.Component<Props> {
})} })}
{showStatus && ( {showStatus && (
<DrawerItem name={<Trans>Status</Trans>} className="status" labelsOnly> <DrawerItem name={<Trans>Status</Trans>} className="status" labelsOnly>
{object.status.conditions.map((condition: { type: string; message: string; status: string }) => { {object.status.conditions.map((condition, index) => {
const { type, message, status } = condition; const { type, reason, message, status } = condition;
const kind = type || reason;
if (!kind) return null;
return ( return (
<Badge <Badge
key={type} label={type} key={kind + index} label={kind}
className={cssNames({ disabled: status === "False" }, type.toLowerCase())} className={cssNames({ disabled: status === "False" }, kind.toLowerCase())}
tooltip={message} tooltip={message}
/> />
); );