edit
This commit is contained in:
parent
fded9c12ac
commit
c40c62f70b
|
@ -123,6 +123,8 @@ export class WfConfDialog implements OnInit {
|
|||
wfTemplates: SimpleResource[] = [];
|
||||
wfParameters: WfParam[] = [];
|
||||
|
||||
editMode: boolean = true;
|
||||
|
||||
wfConfFormStep1 = new FormGroup({
|
||||
workflow: new FormControl('', [Validators.required]),
|
||||
});
|
||||
|
@ -148,6 +150,13 @@ export class WfConfDialog implements OnInit {
|
|||
wfConfFormFinal = new FormGroup({});
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<ResMetadataDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public client: WfConfsClient) {
|
||||
|
||||
if (data.id && data.workflow) {
|
||||
this.editMode = true;
|
||||
} else {
|
||||
this.editMode = false;
|
||||
}
|
||||
|
||||
this.wfConfFormStep1.get('workflow')?.setValue(data.workflow);
|
||||
|
||||
this.wfConfFormStep2.get('name')?.setValue(data.name);
|
||||
|
@ -160,11 +169,13 @@ export class WfConfDialog implements OnInit {
|
|||
this.wfConfFormStep4.get('cronExpression')?.setValue(data.cronExpression);
|
||||
this.wfConfFormStep4.get('cronMinInterval')?.setValue(data.cronMinInterval);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.data.id && this.data.workflow) {
|
||||
if (this.editMode) {
|
||||
this.prepareWfParameters(this.data.workflow);
|
||||
} else {
|
||||
this.client.loadWfTemplates((data: SimpleResource[]) => this.wfTemplates = data);
|
||||
}
|
||||
this.client.loadWfTemplates((data: SimpleResource[]) => this.wfTemplates = data);
|
||||
}
|
||||
|
||||
onChangeWfTemplate(e: MatSelectChange): void {
|
||||
|
|
|
@ -1,30 +1,42 @@
|
|||
<h1 mat-dialog-title>Workflow Configuration</h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
|
||||
<mat-vertical-stepper [linear]="true" #stepper>
|
||||
|
||||
<!-- STEP 1 -->
|
||||
<mat-step [stepControl]="wfConfFormStep1">
|
||||
<form [formGroup]="wfConfFormStep1">
|
||||
<ng-template matStepLabel>Choose Workflow</ng-template>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||
<mat-label>Workflow</mat-label>
|
||||
<mat-select matInput formControlName="workflow" (selectionChange)="onChangeWfTemplate($event)">
|
||||
<mat-option *ngFor="let i of wfTemplates" [value]="i.id">{{i.name}} ({{i.subtype}})</mat-option>
|
||||
<input matInput readonly value="{{data.workflow}}" *ngIf="editMode" />
|
||||
<mat-select matInput formControlName="workflow" (selectionChange)="onChangeWfTemplate($event)"
|
||||
*ngIf="!editMode">
|
||||
<mat-option *ngFor="let i of wfTemplates" [value]="i.name">{{i.name}} ({{i.subtype}})</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="wfConfFormStep1.get('workflow')?.invalid">This field is
|
||||
<strong>required</strong></mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;" *ngIf="editMode">
|
||||
<mat-label>Destroy Workflow</mat-label>
|
||||
<input matInput readonly value="{{data.destroyWf}}" />
|
||||
</mat-form-field>
|
||||
|
||||
<div>
|
||||
<button mat-stroked-button color="primary" matStepperNext>Next</button>
|
||||
</div>
|
||||
</form>
|
||||
</mat-step>
|
||||
|
||||
<!-- STEP 2 -->
|
||||
<mat-step [stepControl]="wfConfFormStep2" label="General">
|
||||
<form [formGroup]="wfConfFormStep2">
|
||||
<section>
|
||||
<mat-checkbox formControlName="enabled">enabled</mat-checkbox>
|
||||
</section>
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;" *ngIf="data.id">
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;" *ngIf="editMode">
|
||||
<mat-label>ID</mat-label>
|
||||
<input matInput readonly value="{{data.id}}" />
|
||||
</mat-form-field>
|
||||
|
@ -44,6 +56,8 @@
|
|||
</div>
|
||||
</form>
|
||||
</mat-step>
|
||||
|
||||
<!-- STEP 3 -->
|
||||
<mat-step [stepControl]="wfConfFormStep3" label="Worflow Parameters">
|
||||
<form [formGroup]="wfConfFormStep3">
|
||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;" *ngFor="let p of wfParameters">
|
||||
|
@ -62,6 +76,8 @@
|
|||
</div>
|
||||
</form>
|
||||
</mat-step>
|
||||
|
||||
<!-- STEP 4 -->
|
||||
<mat-step [stepControl]="wfConfFormStep4" label="Scheduling">
|
||||
<form [formGroup]="wfConfFormStep4">
|
||||
<section>
|
||||
|
@ -88,6 +104,7 @@
|
|||
</form>
|
||||
</mat-step>
|
||||
|
||||
<!-- STEP 5 -->
|
||||
<mat-step>
|
||||
<ng-template matStepLabel>Done</ng-template>
|
||||
<p>You are now done.</p>
|
||||
|
@ -100,5 +117,6 @@
|
|||
</form>
|
||||
</div>
|
||||
</mat-step>
|
||||
|
||||
</mat-vertical-stepper>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue