Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 09dec1f

Browse files
committed
Load parameters on re-launch a task
Resolves #1387
1 parent f6fb3ce commit 09dec1f

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

ui/src/app/tasks/task-launch/task-launch.component.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { TaskLaunchParams } from '../components/tasks.interface';
1212
import { TaskLaunchValidator } from './task-launch.validator';
1313
import { KvRichTextValidator } from '../../shared/components/kv-rich-text/kv-rich-text.validator';
1414
import { BlockerService } from '../../shared/components/blocker/blocker.service';
15+
import { OrderParams } from '../../shared/components/shared.interface';
1516

1617
/**
1718
* Component that provides a launcher of task.
@@ -67,6 +68,7 @@ export class TaskLaunchComponent implements OnInit, OnDestroy {
6768
* @param {TasksService} tasksService
6869
* @param {NotificationService} notificationService
6970
* @param {RoutingStateService} routingStateService
71+
* @param {BlockerService} blockerService
7072
* @param {ActivatedRoute} route
7173
* @param {Router} router
7274
*/
@@ -86,27 +88,54 @@ export class TaskLaunchComponent implements OnInit, OnDestroy {
8688
this.task$ = this.route.params
8789
.pipe(
8890
mergeMap(val => this.tasksService.getDefinition(val.id)),
91+
mergeMap(val => this.tasksService.getTaskExecutions({
92+
sort: 'TASK_EXECUTION_ID',
93+
order: OrderParams.DESC,
94+
page: 0,
95+
size: 1,
96+
q: val.name
97+
}).pipe(
98+
map(val2 => {
99+
let parameters = '';
100+
if (val2.items.length === 1) {
101+
if (val2.items[0].deploymentProperties) {
102+
parameters = Object.keys(val2.items[0].deploymentProperties).map(key => {
103+
if (val2.items[0].deploymentProperties[key] === '******') {
104+
return '';
105+
}
106+
return `${key}=${val2.items[0].deploymentProperties[key]}`;
107+
})
108+
.filter(param => !!param)
109+
.join('\n');
110+
}
111+
}
112+
return {
113+
taskDefinition: val,
114+
parameters
115+
};
116+
})
117+
)),
89118
mergeMap(
90119
val => this.tasksService.getPlatforms()
91120
.pipe(map(val2 => {
92121
if (val2.length === 0) {
93122
this.form = new FormGroup({
94123
args: new FormControl('', KvRichTextValidator.validateKvRichText(this.kvValidators.args)),
95-
props: new FormControl('', KvRichTextValidator.validateKvRichText(this.kvValidators.props)),
124+
props: new FormControl(val.parameters, KvRichTextValidator.validateKvRichText(this.kvValidators.props)),
96125
platform: new FormControl('')
97126
});
98127
} else {
99128
this.form = new FormGroup({
100129
args: new FormControl('', KvRichTextValidator.validateKvRichText(this.kvValidators.args)),
101-
props: new FormControl('', KvRichTextValidator.validateKvRichText(this.kvValidators.props)),
130+
props: new FormControl(val.parameters, KvRichTextValidator.validateKvRichText(this.kvValidators.props)),
102131
platform: new FormControl('', Validators.required)
103132
});
104133
}
105134
if (val2.length === 1) {
106135
this.form.get('platform').setValue(val2[0].name);
107136
}
108137
return {
109-
taskDefinition: val,
138+
taskDefinition: val.taskDefinition,
110139
platforms: val2
111140
};
112141
}))

0 commit comments

Comments
 (0)