mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash on HorizontalPodAutoscalers view (#4276)
This commit is contained in:
parent
3666c56319
commit
a399b8ee20
@ -50,11 +50,14 @@ interface Props extends RouteComponentProps<HpaRouteParams> {
|
|||||||
export class HorizontalPodAutoscalers extends React.Component<Props> {
|
export class HorizontalPodAutoscalers extends React.Component<Props> {
|
||||||
getTargets(hpa: HorizontalPodAutoscaler) {
|
getTargets(hpa: HorizontalPodAutoscaler) {
|
||||||
const metrics = hpa.getMetrics();
|
const metrics = hpa.getMetrics();
|
||||||
const metricsRemainCount = metrics.length - 1;
|
|
||||||
const metricsRemain = metrics.length > 1 ? <>{metricsRemainCount} more...</> : null;
|
|
||||||
const metricValues = hpa.getMetricValues(metrics[0]);
|
|
||||||
|
|
||||||
return <p>{metricValues} {metricsRemain && "+"}{metricsRemain}</p>;
|
if (metrics.length === 0) {
|
||||||
|
return <p>--</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const metricsRemain = metrics.length > 1 ? `+${metrics.length - 1} more...` : "";
|
||||||
|
|
||||||
|
return <p>{hpa.getMetricValues(metrics[0])} {metricsRemain}</p>;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user