Commit de4ef955 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Merge branch 'develop'

parents c66e2d1a f93d7ff5
Pipeline #139874 passed with stages
in 8 minutes and 4 seconds
{
"name": "bmdl-modeler",
"version": "1.0.1",
"version": "1.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "bmdl-modeler",
"version": "1.0.1",
"version": "1.0.2",
"scripts": {
"version": "./generate_version_file.sh $npm_package_version",
"ng": "ng",
......
......@@ -27,8 +27,16 @@
</div>
</div>
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2">Canvas Artifact Preview</h6>
<div *ngIf="companyModel" class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2">
Canvas Artifact Preview: {{ companyModel.definition.name }}
</h6>
<section>
<app-feature-model [featureModel]="companyModel"></app-feature-model>
</section>
<section class="mt-3" *ngIf="companyModel.definition.description">
<h6>Description</h6>
<p class="mb-0">{{ companyModel.definition.description }}</p>
</section>
</div>
</main>
......@@ -26,7 +26,7 @@
>
<div class="alert alert-info my-3">
<p>
Selected building block is currently not executed or has been canceled.
Selected development step is currently not executed or has been canceled.
</p>
<p class="mb-0">
<a
......@@ -80,7 +80,7 @@
processApiService.runningMethod.executionId
]"
>
Go back to building block overview
Go back to development step overview
</a>
</p>
</div>
......
......@@ -133,8 +133,8 @@
formTitle="Add Pattern Instance"
listTitle="Pattern Instances"
[instances]="getPatternInstances()"
[viewInstanceLink]="viewPattern"
(addInstance)="addInstance($event, getPatternInstanceType())"
(viewInstance)="viewPattern($event)"
(deleteInstance)="deleteInstance($event)"
></app-instance-list>
......@@ -143,8 +143,8 @@
formTitle="Add Example Instance"
listTitle="Example Instances"
[instances]="getExampleInstances()"
[viewInstanceLink]="viewExample"
(addInstance)="addInstance($event)"
(viewInstance)="viewExample($event)"
(deleteInstance)="deleteInstance($event)"
></app-instance-list>
</main>
import { Component } from '@angular/core';
import { ExpertModelService } from '../../../canvas-meta-model/expert-model.service';
import { Router } from '@angular/router';
import { ImportExportService } from '../../feature-model/import-export.service';
import { Instance, InstanceType } from '../../../canvas-meta-model/instance';
import { FormGroup } from '@angular/forms';
......@@ -17,8 +16,7 @@ export class ExpertModelComponent {
constructor(
private expertModelLoaderService: ExpertModelLoaderService,
private expertModelService: ExpertModelService,
private importExportService: ImportExportService,
private router: Router
private importExportService: ImportExportService
) {}
async exportModel() {
......@@ -53,30 +51,34 @@ export class ExpertModelComponent {
/**
* Navigate to a single business model.
*
* @param businessModelId id of the business model
* @param instance the pattern instance
* @return the navigation link
*/
async viewExample(businessModelId: number): Promise<void> {
await this.router.navigate([
viewExample = (instance: Instance): string[] => {
return [
'/',
'expertModels',
this.expertModel._id,
'examples',
businessModelId,
]);
}
instance.id.toString(),
];
};
/**
* Navigate to a component to view the pattern
*
* @param patternId the id of the pattern
* @param instance the pattern instance
* @return the navigation link
*/
async viewPattern(patternId: number): Promise<void> {
await this.router.navigate([
viewPattern = (instance: Instance): string[] => {
return [
'/',
'expertModels',
this.expertModel._id,
'patterns',
patternId,
]);
}
instance.id.toString(),
];
};
/**
* Delete an instance by id.
......
......@@ -282,7 +282,7 @@
<h6 class="border-bottom border-gray pb-2 mb-0">Compare</h6>
<div class="text-muted pt-3">
<form [formGroup]="selectOtherInstanceForm" (ngSubmit)="compare()">
<div class="form-group row">
<div class="form-group form-row">
<label for="instance" class="col-sm-4 col-form-label"
>Business Model</label
>
......@@ -303,7 +303,7 @@
</select>
</div>
</div>
<div class="form-group row">
<div class="form-group form-row">
<div class="col-sm-12">
<button
*ngIf="compareInstance === null"
......@@ -331,19 +331,32 @@
<h6 class="border-bottom border-gray pb-2 mb-0">Show pattern</h6>
<div class="text-muted pt-3">
<form [formGroup]="selectPatternForm" (ngSubmit)="showPattern()">
<div class="form-group row">
<div class="form-group form-row">
<label for="pattern" class="col-sm-4 col-form-label">Pattern</label>
<div class="col-sm-8">
<select id="pattern" formControlName="pattern" class="form-control">
<ng-container *ngFor="let instance of expertModel.getPatterns()">
<option [ngValue]="instance.id">
<option [ngValue]="instance">
{{ instance.name }}
</option>
</ng-container>
</select>
</div>
</div>
<div class="form-group row">
<div
*ngIf="
(selectPatternForm.valid || patternInstance != null) &&
selectedPattern != null &&
selectedPattern.description
"
class="form-group form-row"
>
<label class="col-sm-4 col-form-label">Description</label>
<div class="col-sm-8">
{{ selectedPattern.description }}
</div>
</div>
<div class="form-group form-row">
<div class="col-sm-12">
<button
*ngIf="patternInstance === null"
......
......@@ -183,8 +183,7 @@ export class ExampleComponent implements OnInit {
showPattern(): void {
this.uncheckConformance();
this.clearCompare();
const id = this.selectPatternForm.value.pattern;
this.patternInstance = this.expertModel.getInstance(id);
this.patternInstance = this.selectPatternForm.value.pattern;
this.selectPatternForm.get('pattern').disable();
}
......@@ -208,6 +207,10 @@ export class ExampleComponent implements OnInit {
this.usedPatterns = null;
}
get selectedPattern(): Instance | undefined {
return this.selectPatternForm.value.pattern;
}
private initConformanceOptionsForm(activeId: string): void {
if (activeId === 'stepHints') {
this.conformanceOptionsForm.setValue({
......
<form [formGroup]="instanceForm" (ngSubmit)="submitForm()">
<div class="form-group row">
<div class="form-group form-row">
<label for="name" class="col-sm-4 col-form-label">Instance Name</label>
<div class="col-sm-8">
<input
......@@ -10,7 +10,7 @@
/>
</div>
</div>
<div class="form-group row">
<div class="form-group form-row">
<label for="description" class="col-sm-4 col-form-label"
>Instance Description</label
>
......@@ -23,7 +23,7 @@
/>
</div>
</div>
<div class="form-group row">
<div class="form-group form-row">
<div class="col-sm-12">
<button
type="submit"
......
......@@ -3,32 +3,18 @@
<h6 class="border-bottom border-gray pb-2 mb-0">{{ listTitle }}</h6>
<ul class="list-group inner" style="margin: 5px">
<li
*ngFor="let instance of instances"
class="d-flex list-group-item justify-content-between align-items-center"
<li *ngFor="let instance of instances" class="list-group-item">
<app-results-list-item
[viewLink]="viewInstanceLink(instance)"
(delete)="deleteInstance.emit(instance.id)"
>
<span
>{{ instance.name }}
<small class="text-muted" *ngIf="instance.description">{{
instance.description
}}</small></span
>
<div>
<button
(click)="viewInstance.emit(instance.id)"
type="button"
class="btn btn-dark btn-xs"
>
View</button
>&nbsp;
<button
(click)="deleteInstance.emit(instance.id)"
type="button"
class="btn btn-danger btn-xs"
>
Delete
</button>
</div>
<ng-container itemTitle>
{{ instance.name }}
</ng-container>
<ng-container itemDescription>
{{ instance.description }}
</ng-container>
</app-results-list-item>
</li>
</ul>
</div>
......
......@@ -12,8 +12,9 @@ export class InstanceListComponent implements OnInit {
@Input() listTitle: string;
@Input() instances: Instance[];
@Input() viewInstanceLink: (instance: Instance) => string[];
@Output() addInstance = new EventEmitter<FormGroup>();
@Output() viewInstance = new EventEmitter<number>();
@Output() deleteInstance = new EventEmitter<number>();
instanceForm: FormGroup;
......
......@@ -11,7 +11,7 @@
>
<option
*ngFor="let expertModel of expertModels"
[ngValue]="expertModel._id"
[ngValue]="expertModel"
>
{{ expertModel.name }}
</option>
......@@ -24,13 +24,26 @@
<select id="instance" formControlName="instance" class="form-control">
<option
*ngFor="let instance of expertModel ? expertModel.getPatterns() : []"
[ngValue]="instance.id"
[ngValue]="instance"
>
{{ instance.name }}
</option>
</select>
</div>
</div>
<div
*ngIf="
(selectPatternForm.valid || showsPattern) &&
instance != null &&
instance.description
"
class="form-group form-row"
>
<label class="col-sm-4 col-form-label">Description</label>
<div class="col-sm-8">
{{ instance.description }}
</div>
</div>
<div class="form-group form-row">
<div class="col-sm-12">
<button
......
......@@ -3,8 +3,6 @@ import {
EventEmitter,
Input,
OnChanges,
OnDestroy,
OnInit,
Output,
SimpleChanges,
} from '@angular/core';
......@@ -16,16 +14,13 @@ import {
} from '@angular/forms';
import { Instance } from '../../../canvas-meta-model/instance';
import { ExpertModel } from '../../../canvas-meta-model/expert-model';
import { Subscription } from 'rxjs';
@Component({
selector: 'app-instance-select-pattern-form',
templateUrl: './instance-select-pattern-form.component.html',
styleUrls: ['./instance-select-pattern-form.component.css'],
})
export class InstanceSelectPatternFormComponent
implements OnInit, OnChanges, OnDestroy
{
export class InstanceSelectPatternFormComponent implements OnChanges {
@Input() expertModels: ExpertModel[] = [];
@Input() showsPattern = false;
......@@ -40,22 +35,8 @@ export class InstanceSelectPatternFormComponent
instance: [null, Validators.required],
});
expertModel: ExpertModel;
private formSubscription: Subscription;
constructor(private fb: FormBuilder) {}
ngOnInit() {
this.formSubscription = this.featureModelControl.valueChanges.subscribe(
(value) => {
this.expertModel = this.expertModels.find(
(expertModel) => expertModel._id === value
);
}
);
}
ngOnChanges(changes: SimpleChanges) {
if (changes.showsPattern) {
if (changes.showsPattern.currentValue) {
......@@ -66,19 +47,21 @@ export class InstanceSelectPatternFormComponent
}
}
ngOnDestroy() {
if (this.formSubscription) {
this.formSubscription.unsubscribe();
}
}
submit() {
this.showPattern.emit({
instance: this.expertModel.getInstance(this.instanceControl.value),
instance: this.instance,
featureModelId: this.expertModel._id,
});
}
get expertModel(): ExpertModel | undefined {
return this.featureModelControl.value;
}
get instance(): Instance | undefined {
return this.instanceControl.value;
}
get featureModelControl(): FormControl {
return this.selectPatternForm.get('featureModel') as FormControl;
}
......
......@@ -18,7 +18,7 @@
class="btn btn-xs btn-dark mr-1 mb-1"
(click)="viewNode.emit(info.nodeId)"
>
Show method in process
Show development step in process
</button>
<button
class="btn btn-xs btn-info mr-1 mb-1"
......@@ -54,7 +54,7 @@
class="btn btn-xs btn-dark mr-1 mb-1"
(click)="viewNode.emit(info.nodeId)"
>
Show method in process
Show development step in process
</button>
<button
class="btn btn-xs btn-info mr-1 mb-1"
......@@ -83,7 +83,7 @@
class="btn btn-xs btn-dark mr-1 mb-1"
(click)="viewNode.emit(info.nodeId)"
>
Show method in process
Show development step in process
</button>
<button
class="btn btn-xs btn-dark mr-1 mb-1"
......
......@@ -12,7 +12,8 @@
<select id="inputStep" class="form-control" formControlName="step">
<ng-container
*ngFor="
let step of developmentMethod.executionSteps;
let step of executionStepsFormValue ??
developmentMethod.executionSteps;
let index = index
"
>
......
......@@ -8,12 +8,13 @@ import {
Output,
SimpleChanges,
} from '@angular/core';
import { FormGroupDirective } from '@angular/forms';
import { FormControl, FormGroup, FormGroupDirective } from '@angular/forms';
import { Subscription } from 'rxjs';
import { tap } from 'rxjs/operators';
import { ModuleService } from '../../development-process-registry/module-api/module.service';
import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service';
import { DevelopmentMethod } from '../../development-process-registry/development-method/development-method';
import { ExecutionStepsFormValue } from '../shared/execution-steps-form.service';
import { ModuleService } from '../../development-process-registry/module-api/module.service';
@Component({
selector: 'app-development-method-artifact-mapping',
......@@ -23,6 +24,7 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen
export class DevelopmentMethodArtifactMappingComponent
implements OnInit, OnChanges, OnDestroy
{
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod;
@Input() metaModel: { name: string; metaModelType: any };
@Input() stepNumber: number = null;
......@@ -41,7 +43,7 @@ export class DevelopmentMethodArtifactMappingComponent
private moduleService: ModuleService
) {}
ngOnInit() {
ngOnInit(): void {
this.updateSubscriptions();
this.outputChangeSubscription = this.outputControl.valueChanges
.pipe(
......@@ -54,13 +56,19 @@ export class DevelopmentMethodArtifactMappingComponent
.subscribe();
}
ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
if (changes.developmentMethod) {
this.updateSubscriptions();
} else if (
changes.executionStepsFormValue &&
!this.outputControl.value &&
this.stepControl.value != null
) {
this.updateStepArtifacts(this.stepControl.value);
}
}
ngOnDestroy() {
ngOnDestroy(): void {
if (this.outputChangeSubscription) {
this.outputChangeSubscription.unsubscribe();
}
......@@ -69,7 +77,7 @@ export class DevelopmentMethodArtifactMappingComponent
}
}
updateSubscriptions() {
updateSubscriptions(): void {
if (this.stepChangeSubscription) {
this.stepChangeSubscription.unsubscribe();
this.stepChangeSubscription = null;
......@@ -95,7 +103,7 @@ export class DevelopmentMethodArtifactMappingComponent
}
}
updateGroupArtifacts(groupNumber: number) {
updateGroupArtifacts(groupNumber: number): void {
const group = this.developmentMethod.outputArtifacts[groupNumber];
this.artifacts = group.map((artifact) => {
if (!artifact.element || !artifact.element.metaModel) {
......@@ -111,31 +119,41 @@ export class DevelopmentMethodArtifactMappingComponent
});
}
updateStepArtifacts(stepNumber: number) {
updateStepArtifacts(stepNumber: number): void {
if (this.executionStepsFormValue != null) {
const method = this.executionStepsFormValue[stepNumber].method;
if (method != null) {
this.artifacts = method.input;
}
} else {
const step = this.developmentMethod.executionSteps[stepNumber];
this.artifacts = this.moduleService.getModuleMethod(
step.module,
step.method
).input;
}
}
get formGroup() {
get formGroup(): FormGroup {
return this.formGroupDirective.control;
}
get outputControl() {
return this.formGroup.get('output');
get outputControl(): FormControl {
return this.formGroup.get('output') as FormControl;
}
get stepControl() {
return this.formGroup.get('step');
get stepControl(): FormControl {
return this.formGroup.get('step') as FormControl;
}
get groupControl() {
return this.formGroup.get('group');
get groupControl(): FormControl {
return this.formGroup.get('group') as FormControl;
}
artifactConformsToMetaModel(artifact: { name: string; metaModelType: any }) {
artifactConformsToMetaModel(artifact: {
name: string;
metaModelType: any;
}): boolean {
return artifact.metaModelType === this.metaModel.metaModelType;
}
}
......@@ -3,6 +3,7 @@
[formGroup]="$any(control)"
>
<app-development-method-artifact-mapping
[executionStepsFormValue]="executionStepsFormValue"
[developmentMethod]="developmentMethod"
[metaModel]="metaModel"
[stepNumber]="stepNumber"
......