fix composite graph + ui

This commit is contained in:
Michele Artini 2024-01-16 10:29:59 +01:00
parent 188bd79906
commit 8d0c35e98e
4 changed files with 41 additions and 17 deletions

View File

@ -114,7 +114,9 @@ public class ApiController extends DnetRestController {
final String family = WfConfigurationUtils.calculateFamily(conf, false);
final String[] wfTemplateIds = overrideStartWfs.length > 0 ? overrideStartWfs : conf.getWorkflows().toArray(new String[conf.getWorkflows().size()]);
final String[] wfTemplateIds = (overrideStartWfs != null) && (overrideStartWfs.length > 0)
? overrideStartWfs
: conf.getWorkflows().toArray(new String[conf.getWorkflows().size()]);
this.wfManagerService.prepareNewJob(conf, family, wfTemplateIds);

View File

@ -220,21 +220,24 @@ export class WfConfDialog implements OnInit {
})
export class WfConfLauncherDialog {
conf: WfConf;
executionType: string = 'complete';
form = new FormGroup({});
constructor(public dialogRef: MatDialogRef<WfConfLauncherDialog>, @Inject(MAT_DIALOG_DATA) public data: WfConf, public client: WfConfsClient, public dialog: MatDialog) {
this.conf = data;
this.form.controls = {}
this.conf.workflows.forEach(wf => this.form.addControl(wf, new FormControl(true)));
this.conf.workflows.forEach(wf => this.form.addControl(wf, new FormControl({ value: true, disabled: true })));
}
startWfConf() {
let wfs: string[] = [];
this.conf.workflows.forEach(wf => {
if (this.form.get(wf)?.value) { wfs.push(wf); }
});
if (this.executionType == 'partial') {
this.conf.workflows.forEach(wf => {
if (this.form.get(wf)?.value) { wfs.push(wf); }
});
}
this.client.startWfConfiguration(this.conf.id, wfs, (data: WfHistoryEntry) => {
const wfDialogRef = this.dialog.open(WfHistoryDialog, {
@ -248,6 +251,14 @@ export class WfConfLauncherDialog {
});
}
isStartable(): boolean {
if (this.executionType == 'complete') return true;
for (let wf of this.conf.workflows) {
if (this.form.get(wf)?.value) { return true }
}
return false;
}
onNoClick(): void {
this.dialogRef.close();
}

View File

@ -1,17 +1,24 @@
<h1 mat-dialog-title>Workflow Launcher</h1>
<div mat-dialog-content [formGroup]="form">
TODO: REFACTOR THE CONTROLLER METHOD NOT UPDATING THE WORKFLOW LIST
<p *ngFor="let wf of conf.workflows">
<mat-checkbox formControlName="{{wf}}">{{wf}}</mat-checkbox>
</p>
<div mat-dialog-content>
<mat-radio-group [(ngModel)]="executionType">
<mat-radio-button value="complete">Complete execution</mat-radio-button>
<mat-radio-button value="partial">Partial execution</mat-radio-button>
</mat-radio-group>
<hr />
<form [formGroup]="form">
<p *ngFor="let wf of conf.workflows">
<mat-checkbox formControlName="{{wf}}" [disabled]="executionType == 'complete'">{{wf}}</mat-checkbox>
</p>
</form>
</div>
<div mat-dialog-actions>
<button mat-stroked-button color="primary" mat-dialog-close (click)="startWfConf()"><mat-icon
fontIcon="play_arrow"></mat-icon>
<button mat-stroked-button color="primary" mat-dialog-close (click)="startWfConf()"
[disabled]="!isStartable()"><mat-icon fontIcon="play_arrow"></mat-icon>
Start</button>
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
</div>

View File

@ -107,12 +107,16 @@ public class WfConfigurationUtils {
beginNode.getArcs().add(new Arc(newName));
}
for (final Arc arc : n.getArcs()) {
if (WorkflowsConstants.SUCCESS_NODE.equals(arc.getTo())) {
arc.setTo(endNode.getName());
} else {
arc.setTo(wfName + "." + arc.getTo());
if (n.getArcs().size() > 0) {
for (final Arc arc : n.getArcs()) {
if (WorkflowsConstants.SUCCESS_NODE.equals(arc.getTo())) {
arc.setTo(endNode.getName());
} else {
arc.setTo(wfName + "." + arc.getTo());
}
}
} else {
n.getArcs().add(new Arc(endNode.getName()));
}
res.add(n);