X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fservices%2Fstats%2Fstats.service.ts;h=26fd1a3a2aa39db150982be09250cb4d244c2b47;hb=4f8259dcd4597a7c96285907bd33941d44ac456a;hp=255dbca756c972997a0ed790dbae5d4b1c590ac9;hpb=a4c7cdd075d372de0ab352abc46359d88a570d90;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/services/stats/stats.service.ts b/webapp-frontend/src/app/services/stats/stats.service.ts index 255dbca7..26fd1a3a 100644 --- a/webapp-frontend/src/app/services/stats/stats.service.ts +++ b/webapp-frontend/src/app/services/stats/stats.service.ts @@ -2,14 +2,14 @@ * ========================LICENSE_START================================= * O-RAN-SC * %% - * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * Copyright (C) 2019 AT&T Intellectual Property * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ========================LICENSE_END=================================== */ import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { HttpErrorResponse } from '@angular/common/http'; @@ -50,6 +50,8 @@ export class StatsService { }) }; + private basePath = 'api/admin/'; + constructor(private httpClient: HttpClient) { // this.loadConfig(); // this.getLoad(); @@ -103,6 +105,14 @@ export class StatsService { return Math.round((Math.random() * (20 - 0)) + 0); } + // Gets xApp metrics kibana url for the named application + getAppMetricsUrl(appName: string) { + return this.httpClient.get(this.basePath + 'metrics', { + params: new HttpParams() + .set('app', appName) + }); + } + saveConfig(key: string, value: string) { if (key === 'jsonURL') { this.baseJSONServerUrl = value; @@ -134,8 +144,8 @@ export class StatsService { this.delayMax = res[5].value; this.loadMax = res[6].value; }, - (err: HttpErrorResponse) => { - console.log (err.message); + (her: HttpErrorResponse) => { + console.log ('loadConfig failed: ' + her.message); }); } }