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 @@
<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
"
>
......
......@@ -11,9 +11,10 @@ import {
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;
......@@ -57,6 +59,12 @@ export class DevelopmentMethodArtifactMappingComponent
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);
}
}
......@@ -112,12 +120,19 @@ export class DevelopmentMethodArtifactMappingComponent
}
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(): FormGroup {
return this.formGroupDirective.control;
......
......@@ -3,6 +3,7 @@
[formGroup]="$any(control)"
>
<app-development-method-artifact-mapping
[executionStepsFormValue]="executionStepsFormValue"
[developmentMethod]="developmentMethod"
[metaModel]="metaModel"
[stepNumber]="stepNumber"
......
......@@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { DevelopmentMethod } from '../../development-process-registry/development-method/development-method';
import { FormArray, FormArrayName } from '@angular/forms';
import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.service';
import { ExecutionStepsFormValue } from '../shared/execution-steps-form.service';
@Component({
selector: 'app-development-method-artifact-mappings',
......@@ -9,6 +10,7 @@ import { ArtifactMappingFormService } from '../shared/artifact-mapping-form.serv
styleUrls: ['./development-method-artifact-mappings.component.css'],
})
export class DevelopmentMethodArtifactMappingsComponent {
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod;
@Input() metaModel: { name: string; metaModelType: any };
@Input() stepNumber: number = null;
......
......@@ -78,6 +78,7 @@
>
<b>{{ output.name }}</b>
<app-development-method-artifact-mappings
[executionStepsFormValue]="executionStepsFormValue"
[developmentMethod]="developmentMethod"
formArrayName="{{ index }}"
[metaModel]="output"
......
......@@ -26,7 +26,10 @@ import { DevelopmentMethod } from '../../development-process-registry/developmen
import { ConfigurationFormPlaceholderDirective } from '../configuration-form-placeholder.directive';
import { ModuleMethod } from '../../development-process-registry/module-api/module-method';
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({
selector: 'app-development-method-select-execution-step',
......@@ -36,6 +39,7 @@ import { ExecutionStepsFormService } from '../shared/execution-steps-form.servic
export class DevelopmentMethodSelectExecutionStepComponent
implements OnInit, OnChanges, OnDestroy
{
@Input() executionStepsFormValue?: ExecutionStepsFormValue[];
@Input() developmentMethod: DevelopmentMethod;
@Input() stepNumber: number;
......
......@@ -6,6 +6,7 @@
>
<h5>Step #{{ index + 1 }}</h5>
<app-development-method-select-execution-step
[executionStepsFormValue]="formArray.value"
[formGroup]="$any(control)"
[developmentMethod]="developmentMethod"
[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