mirror of https://github.com/rancher/dashboard.git
fix missing job/pod resources on CronJobs/Jobs detail page
This commit is contained in:
parent
54bb391db1
commit
f1e16f5e12
|
|
@ -2,6 +2,7 @@ import { insertAt } from '@shell/utils/array';
|
|||
import { clone } from '@shell/utils/object';
|
||||
import { WORKLOAD_TYPES } from '@shell/config/types';
|
||||
import Workload from './workload';
|
||||
import { WORKLOAD_TYPE_TO_KIND_MAPPING } from '@shell/detail/workload/index';
|
||||
|
||||
export default class CronJob extends Workload {
|
||||
get state() {
|
||||
|
|
@ -47,12 +48,26 @@ export default class CronJob extends Workload {
|
|||
}
|
||||
|
||||
async runNow() {
|
||||
const job = await this.$dispatch('create', clone(this.spec.jobTemplate));
|
||||
const ownerRef = {
|
||||
apiVersion: this.apiVersion,
|
||||
controller: true,
|
||||
kind: this.kind,
|
||||
name: this.metadata.name,
|
||||
uid: this.metadata.uid
|
||||
};
|
||||
|
||||
// Set type and kind to ensure the correct model is returned (via classify). This object will be persisted to the store
|
||||
const job = await this.$dispatch('create', {
|
||||
type: WORKLOAD_TYPES.JOB,
|
||||
kind: WORKLOAD_TYPE_TO_KIND_MAPPING[WORKLOAD_TYPES.JOB],
|
||||
...clone(this.spec.jobTemplate)
|
||||
});
|
||||
|
||||
job.type = WORKLOAD_TYPES.JOB;
|
||||
job.metadata = job.metadata || {};
|
||||
job.metadata.namespace = this.metadata.namespace;
|
||||
job.metadata.generateName = `${ this.metadata.name }-`;
|
||||
// Can't use `generatedName` and no `name`... as this fails schema validation
|
||||
job.metadata.name = `${ this.metadata.name }-${ Date.now() }`;
|
||||
job.metadata.ownerReferences = [ownerRef];
|
||||
|
||||
await job.save();
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ export default class Workload extends WorkloadService {
|
|||
}
|
||||
|
||||
get endpoint() {
|
||||
return this?.metadata?.annotations[CATTLE_PUBLIC_ENDPOINTS];
|
||||
return this?.metadata?.annotations?.[CATTLE_PUBLIC_ENDPOINTS];
|
||||
}
|
||||
|
||||
get desired() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue