Commit 9214e717 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add calculate step selection directly on form

parent 74ba04e4
Pipeline #139865 passed with stages
in 8 minutes
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
<select id="inputStep" class="form-control" formControlName="step"> <select id="inputStep" class="form-control" formControlName="step">
<ng-container <ng-container
*ngFor=" *ngFor="
let step of developmentMethod.executionSteps; let step of executionStepsFormValue ??
developmentMethod.executionSteps;
let index = index let index = index
" "
> >
......
...@@ -11,9 +11,10 @@ import { ...@@ -11,9 +11,10 @@ import {
import { FormControl, FormGroup, FormGroupDirective } from '@angular/forms'; import { FormControl, FormGroup, FormGroupDirective } from '@angular/forms';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { ModuleService } from '../../development-process-registry/module-api/module.service';
import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service'; import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service';
import { DevelopmentMethod } from '../../development-process-registry/development-method/development-method'; 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({ @Component({
selector: 'app-development-method-artifact-mapping', selector: 'app-development-method-artifact-mapping',
...@@ -23,6 +24,7 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen ...@@ -23,6 +24,7 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen
export class DevelopmentMethodArtifactMappingComponent export class DevelopmentMethodArtifactMappingComponent
implements OnInit, OnChanges, OnDestroy implements OnInit, OnChanges, OnDestroy
{ {
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod; @Input() developmentMethod: DevelopmentMethod;
@Input() metaModel: { name: string; metaModelType: any }; @Input() metaModel: { name: string; metaModelType: any };
@Input() stepNumber: number = null; @Input() stepNumber: number = null;
...@@ -57,6 +59,12 @@ export class DevelopmentMethodArtifactMappingComponent ...@@ -57,6 +59,12 @@ export class DevelopmentMethodArtifactMappingComponent
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes.developmentMethod) { if (changes.developmentMethod) {
this.updateSubscriptions(); this.updateSubscriptions();
} else if (
changes.executionStepsFormValue &&
!this.outputControl.value &&
this.stepControl.value != null
) {
this.updateStepArtifacts(this.stepControl.value);
} }
} }
...@@ -112,11 +120,18 @@ export class DevelopmentMethodArtifactMappingComponent ...@@ -112,11 +120,18 @@ export class DevelopmentMethodArtifactMappingComponent
} }
updateStepArtifacts(stepNumber: number): void { updateStepArtifacts(stepNumber: number): void {
const step = this.developmentMethod.executionSteps[stepNumber]; if (this.executionStepsFormValue != null) {
this.artifacts = this.moduleService.getModuleMethod( const method = this.executionStepsFormValue[stepNumber].method;
step.module, if (method != null) {
step.method this.artifacts = method.input;
).input; }
} else {
const step = this.developmentMethod.executionSteps[stepNumber];
this.artifacts = this.moduleService.getModuleMethod(
step.module,
step.method
).input;
}
} }
get formGroup(): FormGroup { get formGroup(): FormGroup {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
[formGroup]="$any(control)" [formGroup]="$any(control)"
> >
<app-development-method-artifact-mapping <app-development-method-artifact-mapping
[executionStepsFormValue]="executionStepsFormValue"
[developmentMethod]="developmentMethod" [developmentMethod]="developmentMethod"
[metaModel]="metaModel" [metaModel]="metaModel"
[stepNumber]="stepNumber" [stepNumber]="stepNumber"
......
...@@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core'; ...@@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { DevelopmentMethod } from '../../development-process-registry/development-method/development-method'; import { DevelopmentMethod } from '../../development-process-registry/development-method/development-method';
import { FormArray, FormArrayName } from '@angular/forms'; import { FormArray, FormArrayName } from '@angular/forms';
import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service'; import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service';
import { ExecutionStepsFormValue } from '../shared/execution-steps-form.service';
@Component({ @Component({
selector: 'app-development-method-artifact-mappings', selector: 'app-development-method-artifact-mappings',
...@@ -9,6 +10,7 @@ import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.serv ...@@ -9,6 +10,7 @@ import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.serv
styleUrls: ['./development-method-artifact-mappings.component.css'], styleUrls: ['./development-method-artifact-mappings.component.css'],
}) })
export class DevelopmentMethodArtifactMappingsComponent { export class DevelopmentMethodArtifactMappingsComponent {
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod; @Input() developmentMethod: DevelopmentMethod;
@Input() metaModel: { name: string; metaModelType: any }; @Input() metaModel: { name: string; metaModelType: any };
@Input() stepNumber: number = null; @Input() stepNumber: number = null;
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
> >
<b>{{ output.name }}</b> <b>{{ output.name }}</b>
<app-development-method-artifact-mappings <app-development-method-artifact-mappings
[executionStepsFormValue]="executionStepsFormValue"
[developmentMethod]="developmentMethod" [developmentMethod]="developmentMethod"
formArrayName="{{ index }}" formArrayName="{{ index }}"
[metaModel]="output" [metaModel]="output"
......
...@@ -26,7 +26,10 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen ...@@ -26,7 +26,10 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen
import { ConfigurationFormPlaceholderDirective } from '../configuration-form-placeholder.directive'; import { ConfigurationFormPlaceholderDirective } from '../configuration-form-placeholder.directive';
import { ModuleMethod } from '../../development-process-registry/module-api/module-method'; import { ModuleMethod } from '../../development-process-registry/module-api/module-method';
import { ConfigurationFormComponent } from '../../development-process-registry/module-api/configuration-form-component'; import { ConfigurationFormComponent } from '../../development-process-registry/module-api/configuration-form-component';
import { ExecutionStepsFormService } from '../shared/execution-steps-form.service'; import {
ExecutionStepsFormService,
ExecutionStepsFormValue,
} from '../shared/execution-steps-form.service';
@Component({ @Component({
selector: 'app-development-method-select-execution-step', selector: 'app-development-method-select-execution-step',
...@@ -36,6 +39,7 @@ import { ExecutionStepsFormService } from '../shared/execution-steps-form.servic ...@@ -36,6 +39,7 @@ import { ExecutionStepsFormService } from '../shared/execution-steps-form.servic
export class DevelopmentMethodSelectExecutionStepComponent export class DevelopmentMethodSelectExecutionStepComponent
implements OnInit, OnChanges, OnDestroy implements OnInit, OnChanges, OnDestroy
{ {
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod; @Input() developmentMethod: DevelopmentMethod;
@Input() stepNumber: number; @Input() stepNumber: number;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
> >
<h5>Step #{{ index + 1 }}</h5> <h5>Step #{{ index + 1 }}</h5>
<app-development-method-select-execution-step <app-development-method-select-execution-step
[executionStepsFormValue]="formArray.value"
[formGroup]="$any(control)" [formGroup]="$any(control)"
[developmentMethod]="developmentMethod" [developmentMethod]="developmentMethod"
[stepNumber]="index" [stepNumber]="index"
......
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