mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using existing implementation for isDefined
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
1244ef5d80
commit
60c30e1212
@ -7,7 +7,7 @@ import "./kube-object-status-icon.scss";
|
||||
|
||||
import React from "react";
|
||||
import { Icon } from "../icon";
|
||||
import { cssNames, formatDuration, getOrInsert } from "../../utils";
|
||||
import { cssNames, formatDuration, getOrInsert, isDefined } from "../../utils";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import kubeObjectStatusTextsForObjectInjectable from "./kube-object-status-texts-for-object.injectable";
|
||||
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||
@ -112,7 +112,7 @@ class NonInjectedKubeObjectStatusIcon extends React.Component<KubeObjectStatusIc
|
||||
|
||||
const statuses = statusTexts
|
||||
.map((statusText) => statusText.resolve(this.props.object))
|
||||
.filter(isNotEmpty);
|
||||
.filter(isDefined);
|
||||
|
||||
if (statuses.length === 0) {
|
||||
return null;
|
||||
@ -139,10 +139,6 @@ class NonInjectedKubeObjectStatusIcon extends React.Component<KubeObjectStatusIc
|
||||
}
|
||||
}
|
||||
|
||||
function isNotEmpty<T>(item: T | null | undefined): item is T {
|
||||
return !!item;
|
||||
}
|
||||
|
||||
export const KubeObjectStatusIcon = withInjectables<Dependencies, KubeObjectStatusIconProps>(
|
||||
NonInjectedKubeObjectStatusIcon,
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user