From 49a84e5a902a24513ca619d393347a6d2ab21be8 Mon Sep 17 00:00:00 2001 From: tillias Date: Sun, 18 Oct 2020 07:37:29 +0200 Subject: [PATCH] Code cleanup #26 --- .../dependency-dashboard.component.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts index 4344b95..74712f7 100644 --- a/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts +++ b/src/main/webapp/app/dashboard/dependency-dashboard/dependency-dashboard.component.ts @@ -10,6 +10,7 @@ import { CreateDependencyDialogService } from './create-dependency-dialog/create import { JhiEventManager } from 'ng-jhipster'; import { forkJoin, Subscription } from 'rxjs'; import { MicroserviceService } from '../../entities/microservice/microservice.service'; +import { map } from 'rxjs/operators'; @Component({ selector: 'jhi-dependency-dashboard', @@ -106,12 +107,21 @@ export class DependencyDashboardComponent implements OnInit, AfterViewInit, OnDe } loadAll(): void { - const dependencies = this.dependencyService.query(); - const microservices = this.microserviceService.query(); - - forkJoin([dependencies, microservices]).subscribe(results => { - this.refreshGraph(results[0].body || [], results[1].body || []); - }); + const dependencies$ = this.dependencyService.query(); + const microservices$ = this.microserviceService.query(); + + forkJoin({ dependencies$, microservices$ }) + .pipe( + map(result => { + return { + dependencies: result.dependencies$.body || [], + microservices: result.microservices$.body || [], + }; + }) + ) + .subscribe(results => { + this.refreshGraph(results.dependencies, results.microservices); + }); } refreshGraph(dependencies: IDependency[], microservices: IMicroservice[]): void {