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

@@ -42,6 +42,7 @@ import { DeploymentReplicaSets } from "./deployment-replicasets";
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
import { boundMethod } from "../../utils";
import logger from "../../../common/logger";
interface Props extends KubeObjectDetailsProps<Deployment> {
}
@@ -75,7 +76,16 @@ export class DeploymentDetails extends React.Component<Props> {
render() {
const { object: deployment } = this.props;
if (!deployment) return null;
if (!deployment) {
return null;
}
if (!(deployment instanceof Deployment)) {
logger.error("[DeploymentDetails]: passed object that is not an instanceof Deployment", deployment);
return null;
}
const { status, spec } = deployment;
const nodeSelector = deployment.getNodeSelectors();
const selectors = deployment.getSelectors();