X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Finstance-selector%2Finstance-selector.service.ts;fp=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Finstance-selector%2Finstance-selector.service.ts;h=c1afb182d7a3f627d88f582d2a4084bd3892e3b0;hb=a0180adc6a1e1ec09472549596428b70d48db3fc;hp=fbc6bbb1b8c3933c63eb6510cfe83744ecf58da8;hpb=6ae7be6cac43f44625e76ae65007d6372d59afdb;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/services/instance-selector/instance-selector.service.ts b/webapp-frontend/src/app/services/instance-selector/instance-selector.service.ts index fbc6bbb1..c1afb182 100644 --- a/webapp-frontend/src/app/services/instance-selector/instance-selector.service.ts +++ b/webapp-frontend/src/app/services/instance-selector/instance-selector.service.ts @@ -22,7 +22,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { shareReplay, tap } from 'rxjs/operators'; -import { RicInstance } from '../../interfaces/dashboard.types'; +import { RicInstance, RicRegion } from '../../interfaces/dashboard.types'; import { DashboardService } from '../dashboard/dashboard.service'; @Injectable({ @@ -30,20 +30,20 @@ import { DashboardService } from '../dashboard/dashboard.service'; }) export class InstanceSelectorService { - private instanceArray: Observable; - private selectedInstance: BehaviorSubject = new BehaviorSubject({ key: '', name:''}); + private allInstances: Observable; + private selectedInstance: BehaviorSubject = new BehaviorSubject({ key: '', name: '' }); constructor( private dashboardSvc: DashboardService, private httpClient: HttpClient) { } - getInstanceArray(): Observable { - if (this.instanceArray) { - return this.instanceArray; + getAllInstances(): Observable { + if (this.allInstances) { + return this.allInstances; } const path = this.dashboardSvc.buildPath('admin', null, 'instance'); - return this.instanceArray = this.httpClient.get(path) + return this.allInstances = this.httpClient.get(path) .pipe( shareReplay(1) ); @@ -57,7 +57,7 @@ export class InstanceSelectorService { } updateSelectedInstance(instance: RicInstance) { - this.selectedInstance.next(instance) + this.selectedInstance.next(instance); } }