history refresh

This commit is contained in:
Michele Artini 2024-01-19 13:31:06 +01:00
parent eb63e6fbc6
commit c65a39e07e
4 changed files with 30 additions and 8 deletions

View File

@ -78,8 +78,8 @@ public class ApiController extends DnetRestController {
}
@GetMapping("/proc/{processId}")
public List<WfJournalEntry> getProcessExecution(@PathVariable final String processId) {
return Arrays.asList(this.wfManagerService.findProcessLog(processId));
public WfJournalEntry getProcessExecution(@PathVariable final String processId) {
return this.wfManagerService.findProcessLog(processId);
}
@GetMapping("/sections")

View File

@ -1,7 +1,5 @@
<h1 mat-dialog-title>Workflow Launcher</h1>
<div mat-dialog-content>
<mat-radio-group [(ngModel)]="executionType">
<mat-radio-button value="complete">Complete execution</mat-radio-button>

View File

@ -276,6 +276,10 @@ export class WfHistoryClient extends ISClient {
this.httpGet(url, onSuccess);
}
findProcess(id: string, onSuccess: Function) {
this.httpGet<WfHistoryEntry>('/proxy/byType/wf_manager/api/proc/' + encodeURIComponent(id), onSuccess);
}
}
@Component({
@ -288,13 +292,22 @@ export class WfRuntimeGraphDialog implements AfterViewInit {
@ViewChild('mermaidGraph', { static: false }) mermaidGraph!: ElementRef;
constructor(public dialogRef: MatDialogRef<WfHistoryDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public dialog: MatDialog, public snackBar: MatSnackBar) {
constructor(public dialogRef: MatDialogRef<WfHistoryDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public dialog: MatDialog, public snackBar: MatSnackBar, public client: WfHistoryClient) {
this.wf = data;
}
public ngAfterViewInit(): void {
this.updateGraph();
}
const element: any = this.mermaidGraph.nativeElement;
public refresh(): void {
this.client.findProcess(this.wf.processId, (data: WfHistoryEntry) => {
this.wf = data;
this.updateGraph();
});
}
private updateGraph(): void {
/* flowchart TD
A[Start] --> B{Is it?}
@ -303,7 +316,6 @@ export class WfRuntimeGraphDialog implements AfterViewInit {
D --> B
B -- No ----> E[End]
*/
let code = "%%{ init: { 'theme': 'base', 'themeVariables': { 'fontSize' : '11px' } } }%%\n";
let cssMap: any = [];
@ -354,7 +366,9 @@ export class WfRuntimeGraphDialog implements AfterViewInit {
code += "classDef default font-size:9pt\n";
const element: Element = this.mermaidGraph.nativeElement;
element.innerHTML = code;
element.removeAttribute('data-processed');
mermaid.initialize({ theme: "base", flowchart: { titleTopMargin: 0, useMaxWidth: false, htmlLabels: false } });
mermaid.run();

View File

@ -1,4 +1,10 @@
<h1 mat-dialog-title>Process {{wf.processId}}</h1>
<h1 mat-dialog-title>Process {{wf.processId}} - {{wf.status}
<span class="badge-label" [ngClass]="{
'badge-success' : wf.status === 'success',
'badge-failure' : wf.status === 'failure',
'badge-pending' : wf.status === 'created' || wf.status === 'accepted'
}">{{wf.status}}</span>
</h1>
<div mat-dialog-content>
<pre class="mermaid" #mermaidGraph style="min-height: 200px;"></pre>
@ -6,4 +12,8 @@
<div mat-dialog-actions>
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
<button mat-stroked-button color="primary" (click)="refresh()">
<mat-icon fontIcon="refresh"></mat-icon>
Refresh
</button>
</div>