Commit 6e786dc1 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add better warnings overview

parent a5daf674
Pipeline #133553 failed with stages
in 8 seconds
......@@ -160,13 +160,30 @@
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2">Warnings</h6>
<div *ngIf="warnings.length === 0 && !isGeneratingWarnings" class="alert alert-success mb-0">
There are no warnings
</div>
<div *ngIf="isGeneratingWarnings" class="alert alert-info mb-0">Loading warnings</div>
<ul *ngIf="warnings.length > 0">
<li *ngFor="let warning of warnings">{{warning}}</li>
</ul>
<ng-container *ngIf="!isGeneratingWarnings">
<h6>Missing Warnings</h6>
<div *ngIf="missingWarnings.length === 0" class="alert alert-success">
There are no warnings about missing situational factors
</div>
<ul *ngIf="missingWarnings.length > 0">
<li *ngFor="let warning of missingWarnings">{{warning}}</li>
</ul>
<h6>Low value Warnings</h6>
<div *ngIf="lowWarnings.length === 0" class="alert alert-success">
There are no warnings about situational factors with a too low value
</div>
<ul *ngIf="lowWarnings.length > 0">
<li *ngFor="let warning of lowWarnings">{{warning}}</li>
</ul>
<h6>Incorrect value Warnings</h6>
<div *ngIf="incorrectWarnings.length === 0" class="alert alert-success mb-0">
There are no warnings about situational factors with an incorrect value
</div>
<ul *ngIf="incorrectWarnings.length > 0">
<li *ngFor="let warning of incorrectWarnings">{{warning}}</li>
</ul>
</ng-container>
</div>
</div>
......@@ -41,7 +41,9 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
developmentMethodId: [null, Validators.required],
});
warnings: string[] = [];
missingWarnings: string[] = [];
lowWarnings: string[] = [];
incorrectWarnings: string[] = [];
isGeneratingWarnings = false;
private wantsToGenerateWarnings = false;
......@@ -249,14 +251,18 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
return;
}
this.isGeneratingWarnings = true;
const warnings: string[] = [];
const missingWarnings: string[] = [];
const lowWarnings: string[] = [];
const incorrectWarnings: string[] = [];
const generateWarnings =
(element: { name: string, situationalFactors: { element: SituationalFactor }[] }, elementName: 'Method' | 'Pattern') => {
const factorMap = SituationalFactor.createMap(element.situationalFactors.map((factor) => factor.element));
const {missing, low, incorrect} = this.bmProcess.checkMatch(factorMap);
missing.forEach((m) => warnings.push(elementName + ' ' + element.name + ' is missing the factor ' + m + '.'));
low.forEach((m) => warnings.push(elementName + ' ' + element.name + ' has a too low value for the factor ' + m + '.'));
incorrect.forEach((m) => warnings.push(elementName + ' ' + element.name + ' has not the correct value for the factor ' + m + '.'));
missing.forEach((m) => missingWarnings.push(elementName + ' ' + element.name + ' is missing the factor ' + m + '.'));
low.forEach((m) => lowWarnings.push(elementName + ' ' + element.name + ' has a too low value for the factor ' + m + '.'));
incorrect.forEach((m) => incorrectWarnings.push(
elementName + ' ' + element.name + ' has not the correct value for the factor ' + m + '.')
);
};
const methodWarnings = this.developmentMethodService.getDevelopmentMethods(this.bpmnService.getUsedMethodIds(this.modeler)).then(
(methods) => methods.forEach(
......@@ -270,7 +276,9 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
);
Promise.all([methodWarnings, patternWarnings]).then(() => {
if (!this.wantsToGenerateWarnings) {
this.warnings = warnings;
this.missingWarnings = missingWarnings;
this.lowWarnings = lowWarnings;
this.incorrectWarnings = incorrectWarnings;
}
}).finally(() => {
this.isGeneratingWarnings = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment