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
@@ -31,8 +31,9 @@ import { Link } from "react-router-dom";
|
||||
import { cronJobStore } from "./cronjob.store";
|
||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { getDetailsUrl } from "../kube-detail-params";
|
||||
import type { CronJob, Job } from "../../../common/k8s-api/endpoints";
|
||||
import { CronJob, Job } from "../../../common/k8s-api/endpoints";
|
||||
import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import logger from "../../../common/logger";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<CronJob> {
|
||||
}
|
||||
@@ -46,18 +47,27 @@ export class CronJobDetails extends React.Component<Props> {
|
||||
render() {
|
||||
const { object: cronJob } = this.props;
|
||||
|
||||
if (!cronJob) return null;
|
||||
if (!cronJob) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(cronJob instanceof CronJob)) {
|
||||
logger.error("[CronJobDetails]: passed object that is not an instanceof CronJob", cronJob);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const childJobs = jobStore.getJobsByOwner(cronJob);
|
||||
|
||||
return (
|
||||
<div className="CronJobDetails">
|
||||
<KubeObjectMeta object={cronJob}/>
|
||||
<DrawerItem name="Schedule">
|
||||
{cronJob.isNeverRun() ? (
|
||||
<>
|
||||
never ({cronJob.getSchedule()})
|
||||
</>
|
||||
) : cronJob.getSchedule()}
|
||||
{
|
||||
cronJob.isNeverRun()
|
||||
? `never (${cronJob.getSchedule()})`
|
||||
: cronJob.getSchedule()
|
||||
}
|
||||
</DrawerItem>
|
||||
<DrawerItem name="Active">
|
||||
{cronJobStore.getActiveJobsNum(cronJob)}
|
||||
|
||||
Reference in new issue
Block a user