mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Check object instanceof on all detail panels (#4054)
* Check object instanceof on all detail panels Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix unit tests - Remove prettier as snapShot testing is too tight of a bound Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
dabfce3609
commit
052d12fc19
32 files changed
+392
-168
No files matched your search
@@ -24,12 +24,13 @@ import "./network-policy-details.scss";
|
||||
import get from "lodash/get";
|
||||
import React, { Fragment } from "react";
|
||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import type { IPolicyEgress, IPolicyIngress, IPolicyIpBlock, IPolicySelector, NetworkPolicy } from "../../../common/k8s-api/endpoints/network-policy.api";
|
||||
import { IPolicyEgress, IPolicyIngress, IPolicyIpBlock, IPolicySelector, NetworkPolicy } from "../../../common/k8s-api/endpoints/network-policy.api";
|
||||
import { Badge } from "../badge";
|
||||
import { SubTitle } from "../layout/sub-title";
|
||||
import { observer } from "mobx-react";
|
||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import logger from "../../../common/logger";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<NetworkPolicy> {
|
||||
}
|
||||
@@ -117,6 +118,13 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
if (!policy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(policy instanceof NetworkPolicy)) {
|
||||
logger.error("[NetworkPolicyDetails]: passed object that is not an instanceof NetworkPolicy", policy);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const { ingress, egress } = policy.spec;
|
||||
const selector = policy.getMatchLabels();
|
||||
|
||||
|
||||
Reference in new issue
Block a user