Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.frontend into SI-1956-BUG-Stationen-fehlen-nach-Verdichtung
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
index b44b3c6..3173860 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
@@ -113,35 +113,47 @@
}
private _registerEvents(): void {
- this.actionsSubject
- .pipe(
+ const allStations$ = this._loadAllStations();
+ combineLatest(
+ allStations$,
+ this.actionsSubject.pipe(
ofType(gridFailureActions.loadCondensedGridFailuresSuccess),
map((action: { payload: GridFailure[] }) => action.payload)
)
- .subscribe((condensedGridFailures: GridFailure[]) => {
- this.condensationList = condensedGridFailures;
- this.condenseBranch = condensedGridFailures && condensedGridFailures.length > 0 ? condensedGridFailures[0].branch : null;
- });
+ ).subscribe(([stations, condensedGridFailures]) => {
+ if (condensedGridFailures && condensedGridFailures.length) {
+ this.condensationList = this._getGridFailureWithReadableStationInformation(condensedGridFailures, stations);
+ this.condenseBranch = condensedGridFailures[0].branch;
+ }
+ });
combineLatest(
- this.actionsSubject.pipe(
- ofType(gridFailureActions.loadStationsSuccess.type),
- map(action => action['payload'])
- ),
+ allStations$,
this.actionsSubject.pipe(
ofType(gridFailureActions.loadGridFailuresSuccess),
map((action: { payload: GridFailure[] }) => action.payload)
)
).subscribe(([stations, gridFailures]) => {
if (gridFailures && gridFailures.length) {
- this.overviewGridFailureList = gridFailures.map(gf => {
- gf.stationDescription = gf.stationIds.hasOwnProperty('value') ? this._getStationDescription((gf.stationIds as any).value, stations) : '';
- return gf;
- }) as any;
+ this.overviewGridFailureList = this._getGridFailureWithReadableStationInformation(gridFailures, stations);
}
});
}
+ private _getGridFailureWithReadableStationInformation(condensedGridFailures: GridFailure[], stations: FailureStation[]): GridFailure[] {
+ return condensedGridFailures.map(cgf => {
+ cgf.stationDescription = 'value' in cgf.stationIds ? this._getStationDescription((cgf.stationIds as any).value, stations) : '';
+ return cgf;
+ }) as any;
+ }
+
+ private _loadAllStations(): Observable<FailureStation[]> {
+ return this.actionsSubject.pipe(
+ ofType(gridFailureActions.loadStationsSuccess.type),
+ map(action => action['payload'])
+ );
+ }
+
private _getStationDescription(stationIds: string[], stations: FailureStation[]): string {
let ret: string = '';
if (!!stationIds && stationIds.length > 0) {