Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.frontend into SI-1633-Zeige-aktuelle-Adresse
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html index 90458ba..dacccea 100644 --- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html +++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html
@@ -13,11 +13,11 @@ <app-card-layout *ngIf="gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async as formState"> <div header> <div class="header-container"> - <div class="header-title"> - <span>{{ 'GridFailure.Title' | translate }}</span> - </div> <div class="diverse-btn-container"> <div> + <span>{{ 'GridFailure.Title' | translate }}</span> + </div> + <div> <button *ngIf="!gridFailureDetailsSandbox.currentFormState.isPristine" type="button" @@ -534,6 +534,17 @@ </select> </div> </div> + <label + class="readOnly" + *ngIf=" + !!formState.value.id && + formState.value.statusIntern !== StateEnum.QUALIFIED && + formState.value.statusIntern !== StateEnum.CANCELED && + formState.value.statusIntern !== StateEnum.COMPLETED + " + >Aktuelle Adresse: <br /> + {{ currentAddress }}</label + > </div> <div class="MS-fields" *ngIf="failureLocationView === Globals.FAILURE_LOCATION_MS && !!gridFailureDetailsSandbox.gridFailureStations">
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss index c8586ce..574e308 100644 --- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss +++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss
@@ -135,3 +135,10 @@ width: 378px; height: 378px; } +.readOnly { + border: 1px solid; + padding: 15px 30px; + width: -webkit-fill-available; + margin-right: 42px; + color: grey; +}
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts index aa52f6f..7d2765a 100644 --- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts +++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts
@@ -311,6 +311,22 @@ expect(spy).not.toHaveBeenCalled(); }); + it('should set member variable "currentAddress"', () => { + component.gridFailureDetailsSandbox.gridFailureDetailsFormState$ = of(INITIAL_STATE, { + ...component.gridFailureDetailsSandbox.currentFormState, + value: { + id: 1 as any, + postcode: 12345 as any, + city: 'testCity' as any, + district: 'testDistrict' as any, + street: 'testStreet' as any, + housenumber: 44 as any, + } as any, + }); + component.ngOnInit(); + expect(component.currentAddress).toBe('12345 testCity (testDistrict), testStreet 44'); + }); + it('should set Branch State correctly', () => { const spy: any = spyOn(gridFailureSandbox, 'setBranchState'); component.gridFailureDetailsSandbox.branches = [new models.FailureBranch()];
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts index 5e1bc55..cb67509 100644 --- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts +++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts
@@ -40,6 +40,7 @@ public StateEnum = StateEnum; public VoltageLevelEnum = VoltageLevelEnum; public gridFailureVersions$: Observable<GridFailure[]> = this.appState$.select(store.getGridFailureVersionsData); + public currentAddress: string = ''; public getGgridFailureVersion = (versionNumber: string) => this.gridFailureVersions$.pipe(map((versions: GridFailure[]) => versions.find((version: GridFailure) => version.versionNumber === +versionNumber))); @@ -84,6 +85,15 @@ } }); this.gridFailureDetailsSandbox.setFormStatePristine(); + + this.gridFailureDetailsSandbox.gridFailureDetailsFormState$ + .pipe( + skipWhile(item => !item.value.housenumber), + take(1) + ) + .subscribe(girdFailure => { + this.currentAddress = `${girdFailure.value.postcode} ${girdFailure.value.city} (${girdFailure.value.district}), ${girdFailure.value.street} ${girdFailure.value.housenumber}`; + }); } public setBranchValue(branchId: string) { const branch = this.gridFailureDetailsSandbox.branches.find(b => b.id === branchId);