This commit is contained in:
parent
be65886fd3
commit
6676c7f26c
|
@ -40,6 +40,7 @@ import { EmailDialog, EmailsComponent } from './emails/emails.component';
|
||||||
import { WfConfsComponent, WfConfDialog } from './wf-confs/wf-confs.component';
|
import { WfConfsComponent, WfConfDialog } from './wf-confs/wf-confs.component';
|
||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
|
import { MatStepperModule } from '@angular/material/stepper';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -105,7 +106,8 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
MatPaginatorModule,
|
MatPaginatorModule,
|
||||||
MatProgressSpinnerModule,
|
MatProgressSpinnerModule,
|
||||||
MatTabsModule
|
MatTabsModule,
|
||||||
|
MatStepperModule
|
||||||
],
|
],
|
||||||
providers: [{
|
providers: [{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
|
|
@ -1,83 +1,97 @@
|
||||||
<form [formGroup]="wfConfForm" (ngSubmit)="onSubmit()">
|
<h1 mat-dialog-title>Workflow Configuration</h1>
|
||||||
<h1 mat-dialog-title>Workflow Configuration</h1>
|
|
||||||
|
|
||||||
<div mat-dialog-content>
|
<div mat-dialog-content>
|
||||||
<section>
|
|
||||||
<mat-checkbox formControlName="enabled">enabled</mat-checkbox>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<mat-card *ngIf="wfConfForm.get('enabled')?.value">
|
<mat-vertical-stepper [linear]="true" #stepper>
|
||||||
<mat-card-header>
|
<mat-step [stepControl]="wfConfFormStep1">
|
||||||
<mat-card-subtitle>Description</mat-card-subtitle>
|
<form [formGroup]="wfConfFormStep1">
|
||||||
</mat-card-header>
|
<ng-template matStepLabel>Choose Workflow</ng-template>
|
||||||
<mat-card-content>
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||||
|
<mat-label>Workflow</mat-label>
|
||||||
|
<input matInput formControlName="workflow" />
|
||||||
|
<mat-error *ngIf="wfConfFormStep1.get('workflow')?.invalid">This field is
|
||||||
|
<strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<div>
|
||||||
|
<button mat-stroked-button color="primary" matStepperNext>Next</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</mat-step>
|
||||||
|
<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="data.id">
|
||||||
<mat-label>ID</mat-label>
|
<mat-label>ID</mat-label>
|
||||||
<input matInput readonly value="{{data.id}}" />
|
<input matInput readonly value="{{data.id}}" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
||||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 80%;">
|
|
||||||
<mat-label>Name</mat-label>
|
<mat-label>Name</mat-label>
|
||||||
<input matInput formControlName="name" />
|
<input matInput formControlName="name" />
|
||||||
<mat-error *ngIf="wfConfForm.get('name')?.invalid">This field is <strong>required</strong></mat-error>
|
<mat-error *ngIf="wfConfFormStep2.get('name')?.invalid">This field is <strong>required</strong></mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 40%;">
|
||||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 20%;">
|
|
||||||
<mat-label>Priority</mat-label>
|
<mat-label>Priority</mat-label>
|
||||||
<input matInput formControlName="priority" />
|
<input matInput formControlName="priority" type="number" step="1" min="1" max="100" />
|
||||||
<mat-error *ngIf="wfConfForm.get('priority')?.invalid">This field is <strong>required</strong></mat-error>
|
<mat-error *ngIf="wfConfFormStep2.get('priority')?.invalid">Numeric value (range: 1-100)</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-card-content>
|
<div>
|
||||||
</mat-card>
|
<button mat-stroked-button color="primary" matStepperPrevious>Back</button>
|
||||||
|
<button mat-stroked-button color="primary" matStepperNext>Next</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</mat-step>
|
||||||
|
<mat-step [stepControl]="wfConfFormStep3" label="Worflow Parameters">
|
||||||
|
<form [formGroup]="wfConfFormStep3">
|
||||||
|
|
||||||
<mat-card style="margin-top: 1em;" *ngIf="wfConfForm.get('enabled')?.value">
|
<div>
|
||||||
<mat-card-header>
|
<button mat-stroked-button color="primary" matStepperPrevious>Back</button>
|
||||||
<mat-card-subtitle>Workflow parameters</mat-card-subtitle>
|
<button mat-stroked-button color="primary" matStepperNext>Next</button>
|
||||||
</mat-card-header>
|
</div>
|
||||||
<mat-card-content>
|
</form>
|
||||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 100%;">
|
</mat-step>
|
||||||
<mat-label>Workflow</mat-label>
|
<mat-step [stepControl]="wfConfFormStep4" label="Scheduling">
|
||||||
<input matInput formControlName="workflow" />
|
<form [formGroup]="wfConfFormStep4">
|
||||||
<mat-error *ngIf="wfConfForm.get('workflow')?.invalid">This field is <strong>required</strong></mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</mat-card-content>
|
|
||||||
</mat-card>
|
|
||||||
|
|
||||||
<mat-card style="margin-top: 1em;" *ngIf="wfConfForm.get('enabled')?.value">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-subtitle>Scheduling</mat-card-subtitle>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content>
|
|
||||||
<section>
|
<section>
|
||||||
<mat-checkbox formControlName="schedulingEnabled">Enabled</mat-checkbox>
|
<mat-checkbox formControlName="schedulingEnabled">Enabled</mat-checkbox>
|
||||||
</section>
|
</section>
|
||||||
<div *ngIf="wfConfForm.get('schedulingEnabled')?.value">
|
<div *ngIf="wfConfFormStep4.get('schedulingEnabled')?.value">
|
||||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 50%;">
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 50%;">
|
||||||
<mat-label>Cron Expression</mat-label>
|
<mat-label>Cron Expression</mat-label>
|
||||||
<input matInput formControlName="cronExpression" />
|
<input matInput formControlName="cronExpression" />
|
||||||
<mat-error *ngIf="wfConfForm.get('cronExpression')?.invalid">This field is
|
<mat-error *ngIf="wfConfFormStep4.get('cronExpression')?.invalid">This field is
|
||||||
<strong>required</strong></mat-error>
|
<strong>required</strong></mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="fill" floatLabel="always" style="width: 50%;">
|
<mat-form-field appearance="fill" floatLabel="always" style="width: 50%;">
|
||||||
<mat-label>Min Interval</mat-label>
|
<mat-label>Min Interval (in minutes)</mat-label>
|
||||||
<input matInput formControlName="cronMinInterval" />
|
<input matInput formControlName="cronMinInterval" type="number" step="10" min="10" max="10080" />
|
||||||
<mat-error *ngIf="wfConfForm.get('cronMinInterval')?.invalid">This field is
|
<mat-error *ngIf="wfConfFormStep4.get('cronMinInterval')?.invalid">This field is
|
||||||
<strong>required</strong></mat-error>
|
<strong>required</strong></mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
<div>
|
||||||
|
<button mat-stroked-button color="primary" matStepperPrevious>Back</button>
|
||||||
|
<button mat-stroked-button color="primary" matStepperNext>Next</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</mat-step>
|
||||||
|
|
||||||
</mat-card>
|
<mat-step>
|
||||||
|
<ng-template matStepLabel>Done</ng-template>
|
||||||
|
<p>You are now done.</p>
|
||||||
|
<div>
|
||||||
|
<form [formGroup]="wfConfFormFinal" (ngSubmit)="onSubmit()">
|
||||||
|
<button mat-stroked-button color="primary" type="submit">Submit</button>
|
||||||
|
<mat-error *ngIf="wfConfFormFinal.errors?.['serverError']">
|
||||||
|
{{ wfConfFormFinal.errors?.['serverError'] }}
|
||||||
|
</mat-error>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</mat-step>
|
||||||
|
</mat-vertical-stepper>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
<div mat-dialog-actions>
|
||||||
|
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
||||||
<div mat-dialog-actions>
|
</div>
|
||||||
<button mat-stroked-button color="primary" type="submit" [disabled]="!wfConfForm.valid">Submit</button>
|
|
||||||
<button mat-stroked-button color="primary" mat-dialog-close>Close</button>
|
|
||||||
<mat-error *ngIf="wfConfForm.errors?.['serverError']">
|
|
||||||
{{ wfConfForm.errors?.['serverError'] }}
|
|
||||||
</mat-error>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ export class WfConfsComponent implements OnInit {
|
||||||
priority: 75,
|
priority: 75,
|
||||||
workflow: '',
|
workflow: '',
|
||||||
schedulingEnabled: false,
|
schedulingEnabled: false,
|
||||||
cronExpression: '',
|
cronExpression: '0 30 12 1/1 * ?',
|
||||||
cronMinInterval: 9600,
|
cronMinInterval: 9600,
|
||||||
details: new Map,
|
details: new Map,
|
||||||
configured: true,
|
configured: true,
|
||||||
|
@ -79,35 +79,51 @@ export class WfConfsComponent implements OnInit {
|
||||||
styleUrls: ['./wf-confs.component.css']
|
styleUrls: ['./wf-confs.component.css']
|
||||||
})
|
})
|
||||||
export class WfConfDialog {
|
export class WfConfDialog {
|
||||||
wfConfForm = new FormGroup({
|
|
||||||
|
wfConfFormStep1 = new FormGroup({
|
||||||
|
workflow: new FormControl('', [Validators.required]),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
wfConfFormStep2 = new FormGroup({
|
||||||
name: new FormControl('', [Validators.required]),
|
name: new FormControl('', [Validators.required]),
|
||||||
//details: Map<string, string>,
|
//details: Map<string, string>,
|
||||||
enabled: new FormControl(true, [Validators.required]),
|
enabled: new FormControl(true, [Validators.required]),
|
||||||
priority: new FormControl(75, [Validators.required, Validators.min(1), Validators.max(100)]),
|
priority: new FormControl(75, [Validators.required, Validators.min(1), Validators.max(100)]),
|
||||||
schedulingEnabled: new FormControl(false, [Validators.required]),
|
});
|
||||||
cronExpression: new FormControl("", [Validators.required]),
|
|
||||||
cronMinInterval: new FormControl("", [Validators.required]),
|
wfConfFormStep3 = new FormGroup({
|
||||||
workflow: new FormControl('', [Validators.required]),
|
|
||||||
//systemParams: Map<string, string>,
|
//systemParams: Map<string, string>,
|
||||||
//userParams: Map<string, string>
|
//userParams: Map<string, string>
|
||||||
});
|
});
|
||||||
|
|
||||||
|
wfConfFormStep4 = new FormGroup({
|
||||||
|
schedulingEnabled: new FormControl(false, [Validators.required]),
|
||||||
|
cronExpression: new FormControl("", [Validators.required]),
|
||||||
|
cronMinInterval: new FormControl("", [Validators.required]),
|
||||||
|
});
|
||||||
|
|
||||||
|
wfConfFormFinal = new FormGroup({});
|
||||||
|
|
||||||
constructor(public dialogRef: MatDialogRef<ResMetadataDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
|
constructor(public dialogRef: MatDialogRef<ResMetadataDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
|
||||||
this.wfConfForm.get('name')?.setValue(data.name);
|
this.wfConfFormStep1.get('workflow')?.setValue(data.workflow);
|
||||||
|
|
||||||
|
this.wfConfFormStep2.get('name')?.setValue(data.name);
|
||||||
|
this.wfConfFormStep2.get('enabled')?.setValue(data.enabled);
|
||||||
|
this.wfConfFormStep2.get('priority')?.setValue(data.priority);
|
||||||
//details
|
//details
|
||||||
this.wfConfForm.get('enabled')?.setValue(data.enabled);
|
|
||||||
this.wfConfForm.get('priority')?.setValue(data.priority);
|
|
||||||
this.wfConfForm.get('schedulingEnabled')?.setValue(data.schedulingEnabled);
|
|
||||||
this.wfConfForm.get('cronExpression')?.setValue(data.cronExpression);
|
|
||||||
this.wfConfForm.get('cronMinInterval')?.setValue(data.cronMinInterval);
|
|
||||||
this.wfConfForm.get('workflow')?.setValue(data.workflow);
|
|
||||||
//systemParams,
|
//systemParams,
|
||||||
//userParams
|
//userParams
|
||||||
|
|
||||||
|
this.wfConfFormStep4.get('schedulingEnabled')?.setValue(data.schedulingEnabled);
|
||||||
|
this.wfConfFormStep4.get('cronExpression')?.setValue(data.cronExpression);
|
||||||
|
this.wfConfFormStep4.get('cronMinInterval')?.setValue(data.cronMinInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
const conf = Object.assign({}, this.data, this.wfConfForm.value);
|
const conf = Object.assign({}, this.data, this.wfConfFormStep1.value, this.wfConfFormStep2.value, this.wfConfFormStep3.value, this.wfConfFormStep4.value);
|
||||||
this.service.saveWfConfiguration(conf, (data: void) => this.dialogRef.close(1), this.wfConfForm);
|
this.service.saveWfConfiguration(conf, (data: void) => this.dialogRef.close(1), this.wfConfFormFinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNoClick(): void {
|
onNoClick(): void {
|
||||||
|
|
Loading…
Reference in New Issue