X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Fe2-mgr%2Fe2-mgr.service.ts;h=dc088a2179fa5c12bd17998f110e0d752d5e3993;hb=b7d7982bbfbf3a1333feb8b811f99497752d3722;hp=b3388cf64403af23f2dbb392679120a9c8686f38;hpb=53f1fcf033e3a166d7203e0a1c5e0971f9c6bc16;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts index b3388cf6..dc088a21 100644 --- a/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts +++ b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts @@ -17,12 +17,13 @@ * limitations under the License. * ========================LICENSE_END=================================== */ -import { Injectable } from '@angular/core'; import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { E2RanDetails, E2SetupRequest } from '../../interfaces/e2-mgr.types'; import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; +import { E2RanDetails, E2SetupRequest } from '../../interfaces/e2-mgr.types'; +import { CommonService } from '../common/common.service'; @Injectable({ providedIn: 'root' @@ -30,9 +31,11 @@ import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; export class E2ManagerService { - private basePath = 'api/e2mgr/nodeb/'; + private component = 'e2mgr'; - constructor(private httpClient: HttpClient) { + constructor( + private httpClient: HttpClient, + private commonSvc: CommonService) { // injects to variable httpClient } @@ -40,8 +43,8 @@ export class E2ManagerService { * Gets E2 client version details * @returns Observable that should yield a String */ - getVersion(): Observable { - const url = this.basePath + 'version'; + getVersion(instanceKey: string): Observable { + const url = 'api/e2mgr/version'; return this.httpClient.get(url).pipe( // Extract the string here map(res => res['data']) @@ -52,32 +55,36 @@ export class E2ManagerService { * Gets RAN details * @returns Observable that should yield an array of objects */ - getRan(): Observable> { - return this.httpClient.get>(this.basePath + 'ran'); + getRan(instanceKey: string): Observable> { + const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'ran'); + return this.httpClient.get>(url); } /** * Sends a request to setup an ENDC/gNodeB connection * @returns Observable. On success there is no data, only a code. */ - endcSetup(req: E2SetupRequest): Observable> { - return this.httpClient.post(this.basePath + 'endc-setup', req, { observe: 'response' }); + endcSetup(instanceKey: string, req: E2SetupRequest): Observable> { + const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'endc-setup'); + return this.httpClient.post(url, req, { observe: 'response' }); } /** * Sends a request to setup an X2/eNodeB connection * @returns Observable. On success there is no data, only a code. */ - x2Setup(req: E2SetupRequest): Observable> { - return this.httpClient.post(this.basePath + 'x2-setup', req, { observe: 'response' }); + x2Setup(instanceKey: string, req: E2SetupRequest): Observable> { + const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'x2-setup'); + return this.httpClient.post(url, req, { observe: 'response' }); } /** * Sends a request to drop all RAN connections * @returns Observable with body. */ - nodebPut(): Observable { - return this.httpClient.put((this.basePath + 'shutdown'), { observe: 'body' }); + nodebPut(instanceKey: string): Observable { + const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'shutdown'); + return this.httpClient.put(url, { observe: 'body' }); } }