Show AC app data visualization in new metrics tab
[portal/ric-dashboard.git] / webapp-frontend / src / app / services / stats / stats.service.ts
index e4e667a..b611732 100644 (file)
@@ -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;