1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+workloads-pods/pod-details-statuses.tsx
2022-03-01 13:06:53 -05:00

36 lines
920 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import "./pod-details-statuses.scss";
import React from "react";
import countBy from "lodash/countBy";
import kebabCase from "lodash/kebabCase";
import type { Pod } from "../../../common/k8s-api/endpoints";
export interface PodDetailsStatusesProps {
pods: Pod[];
}
export class PodDetailsStatuses extends React.Component<PodDetailsStatusesProps> {
render() {
const { pods } = this.props;
if (!pods.length) return null;
const statuses = countBy(pods.map(pod => pod.getStatus()));
return (
<div className="PodDetailsStatuses">
{
Object.keys(statuses).map(key => (
<span key={key} className={kebabCase(key)}>
{key}: {statuses[key]}
</span>
))
}
</div>
);
}
}