This commit is contained in:
Michele Artini 2023-03-30 12:00:37 +02:00
parent b7e7612a12
commit cb08aee137
5 changed files with 50 additions and 12 deletions

View File

@ -23,7 +23,7 @@ import { MatTableModule } from '@angular/material/table';
import { ProtocolsComponent } from './protocols/protocols.component';
import { MainMenuPanelsComponent } from './main-menu-panels/main-menu-panels.component';
import { MatExpansionModule } from '@angular/material/expansion';
import { WfDialog, WfHistoryComponent } from './wf-history/wf-history.component';
import { WfHistoryDialog, WfHistoryComponent } from './wf-history/wf-history.component';
import { MatDialogModule } from '@angular/material/dialog';
import { MatSortModule } from '@angular/material/sort';
import { ResourcesComponent, ResContentDialog, ResCreateNewDialog, ResMetadataDialog } from './resources/resources.component'
@ -50,7 +50,7 @@ import { MatStepperModule } from '@angular/material/stepper';
InfoComponent,
ProtocolsComponent,
WfHistoryComponent,
WfDialog,
WfHistoryDialog,
ResourcesComponent,
ResContentDialog,
ResCreateNewDialog,

View File

@ -5,7 +5,7 @@
configure a new workflow
</button>
<nav mat-tab-nav-bar *ngIf="confs.length > 0">
<nav mat-tab-nav-bar *ngIf="confs.length > 0" style="margin-top: 1em;">
<a mat-tab-link *ngFor="let c of confs" [routerLink]="['/wfs/conf', c.k]" routerLinkActive #rla="routerLinkActive"
[active]="rla.isActive">
{{c.v}}
@ -13,7 +13,21 @@
</nav>
<div *ngIf="conf" style="margin-top: 2em;">
{{conf | json}}
<button mat-stroked-button color="primary" (click)="launchWf()">
<mat-icon fontIcon="add"></mat-icon>
launch
</button>
<button mat-stroked-button color="primary" (click)="editConf()">
<mat-icon fontIcon="edit"></mat-icon>
edit
</button>
<button mat-stroked-button color="warn" (click)="deleteConf()">
<mat-icon fontIcon="delete"></mat-icon>
delete
</button>
<pre>{{conf | json}}</pre>
</div>
<div *ngIf="!conf" style="margin-top: 2em;">

View File

@ -14,7 +14,6 @@ import { ResMetadataDialog } from '../resources/resources.component';
styleUrls: ['./wf-confs.component.css']
})
export class WfConfsComponent implements OnInit {
section?: WfSection;
confs: KeyValue[] = [];
conf?: WfConf;
@ -73,6 +72,24 @@ export class WfConfsComponent implements OnInit {
if (result) this.router.navigate(['/wfs/conf', result.id]);;
});
}
launchWf() {
throw new Error('Method not implemented.');
}
editConf() {
const dialogRef = this.dialog.open(WfConfDialog, {
data: this.conf,
width: '80%'
});
}
deleteConf() {
throw new Error('Method not implemented.');
}
}
@Component({
@ -124,11 +141,18 @@ export class WfConfDialog implements OnInit {
this.wfConfFormStep4.get('cronMinInterval')?.setValue(data.cronMinInterval);
}
ngOnInit(): void {
if (this.data.id && this.data.workflow) {
this.prepareWfParameters(this.data.workflow);
}
this.service.loadSimpleResources("wf_template", (data: SimpleResource[]) => this.wfTemplates = data);
}
onChangeWfTemplate(e: MatSelectChange): void {
this.service.loadSimpleResourceContent(e.value, (data: any) => {
this.prepareWfParameters(e.value);
}
prepareWfParameters(wfTemplateId: string): void {
this.service.loadSimpleResourceContent(wfTemplateId, (data: any) => {
console.log(data);
if (data.parameters) {
this.wfParameters = data.parameters;
@ -142,7 +166,7 @@ export class WfConfDialog implements OnInit {
let validations: ValidatorFn[] = [];
if (p.required) { validations.push(Validators.required); }
if (p.type == 'number') { validations.push(Validators.pattern('^[0-9]*$')); }
this.wfConfFormStep3.addControl(p.name, new FormControl('', validations));
this.wfConfFormStep3.addControl(p.name, new FormControl(this.data.userParams[p.name], validations));
})
});
}

View File

@ -54,7 +54,7 @@ export class WfHistoryComponent implements AfterViewInit, OnInit {
}
openWfDialog(wf: WfHistoryEntry): void {
const wfDialogRef = this.dialog.open(WfDialog, {
const wfDialogRef = this.dialog.open(WfHistoryDialog, {
data: wf
});
}
@ -62,12 +62,12 @@ export class WfHistoryComponent implements AfterViewInit, OnInit {
}
@Component({
selector: 'wf-dialog',
templateUrl: 'wf-dialog.html',
selector: 'wf-history.dialog',
templateUrl: 'wf-history.dialog.html',
styleUrls: ['wf-history.component.css']
})
export class WfDialog {
export class WfHistoryDialog {
startDate: string = '';
endDate: string = '';
duration: string = '';
@ -76,7 +76,7 @@ export class WfDialog {
colums: string[] = ['k', 'v'];
constructor(
public dialogRef: MatDialogRef<WfDialog>,
public dialogRef: MatDialogRef<WfHistoryDialog>,
@Inject(MAT_DIALOG_DATA) public data: WfHistoryEntry,
) {
let list: KeyValue[] = [];