1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/dashboard/client/components/+workloads-pods/pod-details-statuses.tsx
Sebastian Malton b1ff34879a cleanup Lens repo with tighter linting
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
2020-07-09 17:00:23 -04:00

30 lines
739 B
TypeScript

import "./pod-details-statuses.scss";
import * as React from "react";
import countBy from "lodash/countBy";
import kebabCase from "lodash/kebabCase";
import { Pod } from "../../api/endpoints";
interface Props {
pods: Pod[];
}
export class PodDetailsStatuses extends React.Component<Props> {
render(): JSX.Element {
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>
);
}
}