X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Fe2-mgr%2Fe2-mgr.service.ts;h=45d7b5849e646b06b06ed333e871746696749b61;hb=9cf5b95a5bc9810d739d14d324dd7d80cbdb4a7d;hp=dc088a2179fa5c12bd17998f110e0d752d5e3993;hpb=b7d7982bbfbf3a1333feb8b811f99497752d3722;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 dc088a21..45d7b584 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 @@ -23,7 +23,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; import { E2RanDetails, E2SetupRequest } from '../../interfaces/e2-mgr.types'; -import { CommonService } from '../common/common.service'; +import { DashboardService } from '../dashboard/dashboard.service'; @Injectable({ providedIn: 'root' @@ -32,20 +32,20 @@ import { CommonService } from '../common/common.service'; export class E2ManagerService { private component = 'e2mgr'; + private nodebPath = 'nodeb'; constructor( - private httpClient: HttpClient, - private commonSvc: CommonService) { - // injects to variable httpClient + private dashboardSvc: DashboardService, + private httpClient: HttpClient) { } /** * Gets E2 client version details - * @returns Observable that should yield a String + * @returns Observable that yields a String */ getVersion(instanceKey: string): Observable { - const url = 'api/e2mgr/version'; - return this.httpClient.get(url).pipe( + const path = this.dashboardSvc.buildPath(this.component, null, 'version'); + return this.httpClient.get(path).pipe( // Extract the string here map(res => res['data']) ); @@ -53,11 +53,11 @@ export class E2ManagerService { /** * Gets RAN details - * @returns Observable that should yield an array of objects + * @returns Observable that yields an array of E2RanDetails objects */ getRan(instanceKey: string): Observable> { - const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'ran'); - return this.httpClient.get>(url); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'ran'); + return this.httpClient.get>(path); } /** @@ -65,8 +65,8 @@ export class E2ManagerService { * @returns Observable. On success there is no data, only a code. */ 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' }); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'endc-setup'); + return this.httpClient.post(path, req, { observe: 'response' }); } /** @@ -74,8 +74,8 @@ export class E2ManagerService { * @returns Observable. On success there is no data, only a code. */ 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' }); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'x2-setup'); + return this.httpClient.post(path, req, { observe: 'response' }); } /** @@ -83,8 +83,8 @@ export class E2ManagerService { * @returns Observable with body. */ nodebPut(instanceKey: string): Observable { - const url = this.commonSvc.buildPath(instanceKey, this.component, 'nodeb', 'shutdown'); - return this.httpClient.put(url, { observe: 'body' }); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'shutdown'); + return this.httpClient.put(path, { observe: 'body' }); } }