Allow validation of workflow while viewing a diagram.

This commit is contained in:
Dan Funk 2020-08-27 14:10:23 -04:00
parent 7f96ad5653
commit b97c5fe396
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,8 @@
<button mat-button (click)="saveChanges()" [disabled]="!hasChanged()"><mat-icon>save</mat-icon></button>
<button mat-button (click)="validate()" [disabled]="hasChanged()"><mat-icon>verified_user</mat-icon></button>
<button mat-button [matMenuTriggerFor]="downloadMenu" title="Download diagram">
<mat-icon>save_alt</mat-icon>
<mat-icon>arrow_drop_down</mat-icon>

View File

@ -148,6 +148,16 @@ export class ModelerComponent implements AfterViewInit {
}
}
validate() {
this.api.validateWorkflowSpecification(this.diagramFileMeta.workflow_spec_id).subscribe(apiErrors => {
if (apiErrors && apiErrors.length > 0) {
this.bottomSheet.open(ApiErrorsComponent, {data: {apiErrors: apiErrors}});
} else {
this.snackBar.open('Workflow specification is valid!', 'Ok', {duration: 5000});
}
});
}
hasChanged(): boolean {
return this.xml !== this.draftXml;
}