This commit is contained in:
Michele Artini 2024-01-15 15:21:40 +01:00
parent 5f32759230
commit aba43e4429
7 changed files with 83 additions and 21 deletions

View File

@ -44,7 +44,7 @@ import { MatStepperModule } from '@angular/material/stepper';
import { IndexComponent } from './index/index.component';
import { OaiComponent } from './oai/oai.component';
import { SwaggerUiComponent } from './swagger/swagger-ui.component';
import { WfTemplateDialog, WfConfDialog } from './wf-confs/wf-common.component';
import { WfTemplateDialog, WfConfDialog, WfConfLauncherDialog } from './wf-confs/wf-common.component';
import { MatMenuModule } from '@angular/material/menu';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
@ -87,6 +87,7 @@ import { MatNativeDateModule } from '@angular/material/core';
WfHistoryDetailsDialog,
WfHistoryTableComponent,
WfRuntimeGraphDialog,
WfConfLauncherDialog,
IndexComponent,
OaiComponent,
SwaggerUiComponent

View File

@ -195,7 +195,7 @@
<mat-icon fontIcon="delete"></mat-icon>
delete
</button>
<button mat-stroked-button color="primary" (click)="startWfConf(wf.id)"
<button mat-stroked-button color="primary" (click)="openLaunchWfConfDialog(wf)"
[disabled]="!wf.enabled || !wf.configured">
<mat-icon fontIcon="play_arrow"></mat-icon>
start

View File

@ -10,7 +10,7 @@ import { PageEvent } from '@angular/material/paginator';
import { FormBuilder, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
import { MatSelectChange } from '@angular/material/select';
import { DsmClient } from './dsm.client';
import { WfConfDialog, WfTemplateDialog } from '../wf-confs/wf-common.component';
import { WfConfDialog, WfConfLauncherDialog, WfTemplateDialog } from '../wf-confs/wf-common.component';
import { WfHistoryDialog } from '../wf-history/wf-history.component';
@Component({
@ -162,16 +162,9 @@ export class DsmApiComponent implements OnInit {
}
}
startWfConf(wfConfId: string): void {
this.client.dsmStartWfConf(wfConfId, (data: WfHistoryEntry) => {
const wfDialogRef = this.dialog.open(WfHistoryDialog, {
data: {
'dsId': this.ds.id,
'apiId': this.api.id,
'processId': data.processId,
'confId': undefined
}
});
openLaunchWfConfDialog(conf: WfConf): void {
const wfDialogRef = this.dialog.open(WfConfLauncherDialog, {
data: conf
});
}

View File

@ -1,11 +1,13 @@
import { Component, Inject, OnInit, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
import { FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import { MatSelectChange } from '@angular/material/select';
import { SimpleResource, WfParam, WfTemplateDesc } from '../common/is.model';
import { SimpleResource, WfConf, WfHistoryEntry, WfParam, WfTemplateDesc } from '../common/is.model';
import { ResMetadataDialog } from '../resources/resources.component';
import { WfConfsClient } from './wf-confs.client';
import mermaid from 'mermaid';
import { FactoryTarget } from '@angular/compiler';
import { WfHistoryDialog } from '../wf-history/wf-history.component';
@Component({
selector: 'wf-template-dialog',
@ -210,3 +212,43 @@ export class WfConfDialog implements OnInit {
this.dialogRef.close();
}
}
@Component({
selector: 'wf-conf-laucher-dialog',
templateUrl: './wf-conf-launcher.dialog.html',
styleUrls: []
})
export class WfConfLauncherDialog {
conf: WfConf;
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)));
}
startWfConf() {
let wfs: string[] = [];
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, {
data: {
'dsId': this.conf.dsId,
'apiId': this.conf.apiId,
'processId': data.processId,
'confId': undefined
}
});
});
}
onNoClick(): void {
this.dialogRef.close();
}
}

View File

@ -0,0 +1,17 @@
<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>
<div mat-dialog-actions>
<button mat-stroked-button color="primary" mat-dialog-close (click)="startWfConf()"><mat-icon
fontIcon="play_arrow"></mat-icon>
Start</button>
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
</div>

View File

@ -33,8 +33,17 @@ export class WfConfsClient extends ISClient {
this.httpDelete('/proxy/byType/wf_manager/api/conf/' + encodeURIComponent(id), onSuccess);
}
startWfConfiguration(id: string, onSuccess: Function): void {
this.httpGet<WfHistoryEntry>('/proxy/byType/wf_manager/api/conf/' + encodeURIComponent(id) + '/start', onSuccess);
startWfConfiguration(id: string, wfs: string[], onSuccess: Function): void {
let opts = '';
wfs.forEach(wf => {
if (opts) { opts += '&' }
opts += 'wf=' + encodeURIComponent(wf);
});
let url = '/proxy/byType/wf_manager/api/conf/' + encodeURIComponent(id) + '/start';
if (opts) url += '?' + opts;
this.httpGet<WfHistoryEntry>(url, onSuccess);
}
startDestroyWfConfiguration(id: string, onSuccess: Function): void {

View File

@ -10,7 +10,7 @@ import { ResMetadataDialog } from '../resources/resources.component';
import { MatTableDataSource } from '@angular/material/table';
import { WfHistoryDialog } from '../wf-history/wf-history.component';
import { WfConfsClient } from './wf-confs.client';
import { WfConfDialog } from './wf-common.component';
import { WfConfDialog, WfConfLauncherDialog } from './wf-common.component';
@Component({
selector: 'app-wf-confs',
@ -107,9 +107,9 @@ export class WfConfSingle implements OnInit, OnChanges {
}
launchWfConf() {
if (this.conf?.id && this.conf?.workflows) {
this.client.startWfConfiguration(this.conf?.id, (data: WfHistoryEntry) => this.snackBar.open('Workflow launched !!!', 'INFO', { duration: 5000 }));
}
const wfDialogRef = this.dialog.open(WfConfLauncherDialog, {
data: this.conf
});
}
editConf() {