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

@@ -26,10 +26,11 @@ import { observer } from "mobx-react";
import { DrawerItem, DrawerTitle } from "../drawer";
import { cpuUnitsToNumber, cssNames, unitsToBytes, metricUnitsToNumber } from "../../utils";
import type { KubeObjectDetailsProps } from "../kube-object-details";
import type { ResourceQuota } from "../../../common/k8s-api/endpoints/resource-quota.api";
import { ResourceQuota } from "../../../common/k8s-api/endpoints/resource-quota.api";
import { LineProgress } from "../line-progress";
import { Table, TableCell, TableHead, TableRow } from "../table";
import { KubeObjectMeta } from "../kube-object-meta";
import logger from "../../../common/logger";
interface Props extends KubeObjectDetailsProps<ResourceQuota> {
}
@@ -77,7 +78,15 @@ export class ResourceQuotaDetails extends React.Component<Props> {
render() {
const { object: quota } = this.props;
if (!quota) return null;
if (!quota) {
return null;
}
if (!(quota instanceof ResourceQuota)) {
logger.error("[ResourceQuotaDetails]: passed object that is not an instanceof ResourceQuota", quota);
return null;
}
return (
<div className="ResourceQuotaDetails">