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:
Sebastian Malton authored and GitHub committed 2021-10-15 12:11:46 -04:00
1 parent dabfce3609
commit 052d12fc19
32 files changed
+392 -168

No files matched your search

@@ -31,6 +31,7 @@ import { PersistentVolume, pvcApi } from "../../../common/k8s-api/endpoints";
import type { KubeObjectDetailsProps } from "../kube-object-details";
import { KubeObjectMeta } from "../kube-object-meta";
import { getDetailsUrl } from "../kube-detail-params";
import logger from "../../../common/logger";
interface Props extends KubeObjectDetailsProps<PersistentVolume> {
}
@@ -43,6 +44,13 @@ export class PersistentVolumeDetails extends React.Component<Props> {
if (!volume) {
return null;
}
if (!(volume instanceof PersistentVolume)) {
logger.error("[PersistentVolumeDetails]: passed object that is not an instanceof PersistentVolume", volume);
return null;
}
const { accessModes, capacity, persistentVolumeReclaimPolicy, storageClassName, claimRef, flexVolume, mountOptions, nfs } = volume.spec;
return (