X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Fac-xapp%2Fac-xapp.service.ts;h=4e7231723f62520af6e5562ca8e4ca46dd1def0b;hb=c1c667f0a1aa289655b5309aff4c1c748733f4d2;hp=6e67b32d7144cc91fce092905c2fdc73317c4bac;hpb=b7d7982bbfbf3a1333feb8b811f99497752d3722;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts index 6e67b32d..4e723172 100644 --- a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts +++ b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts @@ -24,7 +24,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ACAdmissionIntervalControl, ACAdmissionIntervalControlAck } from '../../interfaces/ac-xapp.types'; import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; -import { CommonService } from '../common/common.service'; +import { DashboardService } from '../dashboard/dashboard.service'; /** * Services for calling the Dashboard's A1 endpoints to get/put AC policies. @@ -39,18 +39,17 @@ export class ACXappService { private acPolicyName = 'admission_control_policy'; constructor( - private httpClient: HttpClient, - private commonSvc: CommonService) { - // injects to variable httpClient + private dashboardSvc: DashboardService, + private httpClient: HttpClient) { } /** - * Gets version details - * @returns Observable that should yield a String + * Gets AC client version details + * @returns Observable that yields a String */ - getVersion(): Observable { - const url = 'api/a1-p/version' - return this.httpClient.get(url).pipe( + getVersion(instanceKey: string): Observable { + const path = this.dashboardSvc.buildPath(this.component, null, 'version'); + return this.httpClient.get(path).pipe( // Extract the string here map(res => res['data']) ); @@ -58,21 +57,21 @@ export class ACXappService { /** * Gets admission control policy. - * @returns Observable that should yield an ACAdmissionIntervalControl + * @returns Observable that yields an ACAdmissionIntervalControl */ getPolicy(instanceKey: string): Observable { - const url = this.commonSvc.buildPath(instanceKey, this.component, this.policyPath, this.acPolicyName); - return this.httpClient.get(url); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.policyPath, this.acPolicyName); + return this.httpClient.get(path); } /** * Puts admission control policy. * @param policy an instance of ACAdmissionIntervalControl - * @returns Observable that should yield a response code, no data + * @returns Observable that yields a response code, no data */ putPolicy(instanceKey: string, policy: ACAdmissionIntervalControl): Observable { - const url = this.commonSvc.buildPath(instanceKey, this.component, this.policyPath, this.acPolicyName); - return this.httpClient.put(url, policy, { observe: 'response' }); + const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.policyPath, this.acPolicyName); + return this.httpClient.put(path, policy, { observe: 'response' }); } }