Skip to content

Commit 6c6967f

Browse files
committed
fix(web): schedule in cloned task template
1 parent 9b7f5b7 commit 6c6967f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

web/src/components/TemplateForm.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -426,49 +426,55 @@ export default {
426426
async afterLoadData() {
427427
if (this.sourceItemId) {
428428
this.item = (await axios({
429-
keys: 'get',
430429
url: `/api/project/${this.projectId}/templates/${this.sourceItemId}`,
431430
responseType: 'json',
432431
})).data;
432+
433433
this.item.id = null;
434+
434435
if (this.item.vaults) {
435436
for (let i = 0; i < this.item.vaults.length; i += 1) {
436437
this.item.vaults[i].id = null;
437438
}
438439
}
439-
// TODO: update vault and scheduleW
440+
441+
const sourceSchedule = (await axios({
442+
url: `/api/project/${this.projectId}/templates/${this.sourceItemId}/schedules`,
443+
responseType: 'json',
444+
})).data[0];
445+
446+
if (sourceSchedule != null) {
447+
this.cronFormat = sourceSchedule.cron_format;
448+
this.cronRepositoryId = sourceSchedule.repository_id;
449+
this.cronVisible = this.cronRepositoryId != null;
450+
}
440451
}
441452
442453
this.advancedOptions = this.item.arguments != null || this.item.allow_override_args_in_task;
443454
444455
this.repositories = (await axios({
445-
keys: 'get',
446456
url: `/api/project/${this.projectId}/repositories`,
447457
responseType: 'json',
448458
})).data;
449459
450460
this.inventory = [
451461
...(await axios({
452-
keys: 'get',
453462
url: `/api/project/${this.projectId}/inventory?app=${this.app}&template_id=${this.itemId}`,
454463
responseType: 'json',
455464
})).data,
456465
457466
...(await axios({
458-
keys: 'get',
459467
url: `/api/project/${this.projectId}/inventory?app=${this.app}`,
460468
responseType: 'json',
461469
})).data,
462470
];
463471
464472
this.environment = (await axios({
465-
keys: 'get',
466473
url: `/api/project/${this.projectId}/environment`,
467474
responseType: 'json',
468475
})).data;
469476
470477
const template = (await axios({
471-
keys: 'get',
472478
url: `/api/project/${this.projectId}/templates`,
473479
responseType: 'json',
474480
})).data;
@@ -503,13 +509,11 @@ export default {
503509
this.buildTemplates.push(...deploys);
504510
505511
this.schedules = this.isNew ? [] : (await axios({
506-
keys: 'get',
507512
url: `/api/project/${this.projectId}/templates/${this.itemId}/schedules`,
508513
responseType: 'json',
509514
})).data;
510515
511516
this.views = (await axios({
512-
keys: 'get',
513517
url: `/api/project/${this.projectId}/views`,
514518
responseType: 'json',
515519
})).data;

0 commit comments

Comments
 (0)