Commit 0dcf4918 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add building block summary

parent 8bf2f843
Pipeline #133989 failed with stages
in 8 seconds
......@@ -5,6 +5,15 @@ import { Tool } from './tool';
import { MethodElement } from './method-element';
import { MultipleSelection } from './multiple-selection';
export class GroupSummary<T extends MethodElement> {
elements: {
list: string,
elements: T[],
multiple: boolean,
multipleElements: boolean,
}[];
}
export class GroupSelection<T extends MethodElement> {
selectedGroup: number = null;
elements: T[][] = null;
......@@ -42,6 +51,31 @@ export class GroupSelection<T extends MethodElement> {
});
}
getList(providedByMethod: MultipleSelection<T>[][]): GroupSummary<T> {
const summary: GroupSummary<T> = {
elements: [],
};
if (this.selectedGroup === null || this.selectedGroup === undefined) {
return summary;
}
const group = providedByMethod[this.selectedGroup];
summary.elements = group.map((element, index) => {
const part = {
list: element.list,
elements: [],
multiple: element.multiple,
multipleElements: element.multipleElements,
};
if (element.element) {
part.elements = [element.element];
} else if (this.elements) {
part.elements = this.elements[index];
}
return part;
});
return summary;
}
toPouchDb(): any {
return {
selectedGroup: this.selectedGroup,
......@@ -88,6 +122,35 @@ export class Decision {
);
}
getSummary(): {
inputArtifacts: GroupSummary<Artifact>,
outputArtifacts: GroupSummary<Artifact>,
stakeholders: GroupSummary<Stakeholder>,
tools: GroupSummary<Tool>
} {
return {
inputArtifacts: this.inputArtifacts.getList(this.method.inputArtifacts),
outputArtifacts: this.outputArtifacts.getList(this.method.outputArtifacts),
stakeholders: this.stakeholders.getList(this.method.stakeholders),
tools: {
elements: this.method.tools.map((tool, index) => {
const part = {
list: tool.list,
elements: [],
multiple: tool.multiple,
multipleElements: tool.multipleElements,
};
if (tool.element) {
part.elements = [tool.element];
} else if (this.tools) {
part.elements = this.tools[index];
}
return part;
})
},
};
}
toPouchDb(): any {
return {
method: this.method.toPouchDb(),
......
......@@ -110,6 +110,18 @@
</div>
</ng-template>
<ng-template #developmentMethodSummaryModal let-d="dismiss">
<div class="modal-header">
<h4 class="modal-title">Summary of Activity {{modalElement.businessObject.name}}</h4>
<button type="button" class="close" aria-label="Close" (click)="d()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<app-development-method-summary [decision]="bmProcess.decisions[modalElement.id]"></app-development-method-summary>
</div>
</ng-template>
<ng-template #patternInfoModal let-d="dismiss">
<div class="modal-header">
<h4 *ngIf="modalElement.businessObject.taskName" class="modal-title">
......
......@@ -61,6 +61,7 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
@ViewChild('selectDevelopmentMethodModal', {static: true}) selectDevelopmentMethodModal: any;
@ViewChild('selectProcessPatternModal', {static: true}) selectProcessPatternModal: any;
@ViewChild('showTypesModal', {static: true}) showTypesModal: any;
@ViewChild('developmentMethodSummaryModal', {static: true}) developmentMethodSummaryModal: any;
constructor(
private bpmnService: BpmnService,
......@@ -81,6 +82,7 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
eventBus.on('bmp.showTypes', (event, taskElement) => this.openShowTypesModal(taskElement));
eventBus.on('bmp.showMethod', (event, methodElement) => this.openMethodInfoModal(methodElement));
eventBus.on('bmp.showPattern', (event, processPatternElement) => this.openProcessPatternInfoModal(processPatternElement));
eventBus.on('bmp.summary', (event, methodElement) => this.openDevelopmentMethodSummary(methodElement));
if (this.bmProcess) {
this.loadBmProcess(this.bmProcess, true);
}
......@@ -203,6 +205,11 @@ export class BmProcessDiagramComponent implements DiagramComponentInterface, OnI
this.modalReference = this.modalService.open(this.methodInfoModal, {size: 'lg'});
}
private openDevelopmentMethodSummary(methodElement) {
this.modalElement = methodElement;
this.modalReference = this.modalService.open(this.developmentMethodSummaryModal, {size: 'lg'});
}
openProcessPatternInfoModal(processPatternElement) {
this.modalElement = processPatternElement;
this.processPatternService.getProcessPattern(processPatternElement.businessObject.get('processPatternId')).then(
......
......@@ -65,13 +65,21 @@ export default class BmProcessContextPadProvider {
};
if (element.businessObject.method) {
controls['bmp.showMethod'] = {
group: 'info',
className: 'fas fa-info-circle font-bpmn-adaption',
title: 'Show Method Building Block details',
group: 'edit',
className: 'fas fa-clipboard-list font-bpmn-adaption',
title: 'Edit Method Building Block details',
action: {
click: () => this.eventBus.fire('bmp.showMethod', element),
}
};
controls['bmp.summary'] = {
group: 'info',
className: 'fas fa-clipboard-check font-bpmn-adaption',
title: 'Show Method Building Block summary',
action: {
click: () => this.eventBus.fire('bmp.summary', element),
}
};
controls['bmp.removeMethod'] = {
group: 'edit',
className: 'far fa-trash-alt font-bpmn-adaption',
......
<ng-template #defaultCell let-list="list">
<ul>
<li *ngFor="let element of asGroupSummary(list).elements">
<ng-container *ngIf="element.multiple">
[<<{{element.list}}>>]
<ul>
<li *ngFor="let concreteElement of element.elements">{{concreteElement.name}}</li>
</ul>
</ng-container>
<ng-container *ngIf="!element.multiple">
<ng-container *ngIf="element.elements.length === 1">
<ng-container *ngIf="element.multipleElements">
[{{element.elements[0].name}}] (<<{{element.elements[0].list}}>>)
</ng-container>
<ng-container *ngIf="!element.multipleElements">
{{element.elements[0].name}} (<<{{element.elements[0].list}}>>)
</ng-container>
</ng-container>
<ng-container *ngIf="element.elements.length === 0">
(<<{{element.list}}>>)
</ng-container>
</ng-container>
</li>
</ul>
</ng-template>
<table class="table mb-0">
<tbody>
<tr>
<th scope="row">Building Block Name</th>
<td>{{decision.method.name}}</td>
</tr>
<tr>
<th scope="row">Building Block Description</th>
<td class="show-new-lines">{{decision.method.description}}</td>
</tr>
<tr *ngIf="decision.method.examples.length > 0">
<th scope="row">Examples</th>
<td class="show-new-lines">
<ul class="list-group">
<li *ngFor="let example of decision.method.examples" class="list-group-item">
{{example}}
</li>
</ul>
</td>
</tr>
<tr>
<th scope="row">Input Artifacts</th>
<td>
<ng-container *ngTemplateOutlet="defaultCell; context: {list: this.summary.inputArtifacts}"></ng-container>
</td>
</tr>
<tr>
<th scope="row">Output Artifacts</th>
<td>
<ng-container *ngTemplateOutlet="defaultCell; context: {list: this.summary.outputArtifacts}"></ng-container>
</td>
</tr>
<tr>
<th scope="row">Involved Stakeholders</th>
<td>
<ng-container *ngTemplateOutlet="defaultCell; context: {list: this.summary.stakeholders}"></ng-container>
</td>
</tr>
<tr>
<th scope="row">Tools</th>
<td>
<ng-container *ngTemplateOutlet="defaultCell; context: {list: this.summary.tools}"></ng-container>
</td>
</tr>
</tbody>
</table>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DevelopmentMethodSummaryComponent } from './development-method-summary.component';
describe('DevelopmentMethodSummaryComponent', () => {
let component: DevelopmentMethodSummaryComponent;
let fixture: ComponentFixture<DevelopmentMethodSummaryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DevelopmentMethodSummaryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DevelopmentMethodSummaryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Decision, GroupSummary } from '../../development-process-registry/decision';
import { Artifact } from '../../development-process-registry/artifact';
import { Stakeholder } from '../../development-process-registry/stakeholder';
import { Tool } from '../../development-process-registry/tool';
import { MethodElement } from '../../development-process-registry/method-element';
@Component({
selector: 'app-development-method-summary',
templateUrl: './development-method-summary.component.html',
styleUrls: ['./development-method-summary.component.css']
})
export class DevelopmentMethodSummaryComponent implements OnChanges {
@Input() decision: Decision;
summary: {
inputArtifacts: GroupSummary<Artifact>,
outputArtifacts: GroupSummary<Artifact>,
stakeholders: GroupSummary<Stakeholder>,
tools: GroupSummary<Tool>
};
ngOnChanges(changes: SimpleChanges) {
if (changes.decision) {
this.summary = changes.decision.currentValue.getSummary();
}
}
asGroupSummary<T extends MethodElement>(element: any): GroupSummary<T> {
return element as GroupSummary<T>;
}
}
......@@ -48,6 +48,7 @@ import {
} from './development-methods-selection-form/development-methods-selection-form.component';
import { ProcessPatternSelectionFormComponent } from './process-pattern-selection-form/process-pattern-selection-form.component';
import { ProcessPatternsSelectionFormComponent } from './process-patterns-selection-form/process-patterns-selection-form.component';
import { DevelopmentMethodSummaryComponent } from './development-method-summary/development-method-summary.component';
@NgModule({
......@@ -95,6 +96,7 @@ import { ProcessPatternsSelectionFormComponent } from './process-patterns-select
DevelopmentMethodsSelectionFormComponent,
ProcessPatternSelectionFormComponent,
ProcessPatternsSelectionFormComponent,
DevelopmentMethodSummaryComponent,
],
entryComponents: [ConfirmLeaveModalComponent],
imports: [
......
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