Drop Nokia from file header copyright line, part 2
[portal/ric-dashboard.git] / webapp-frontend / src / app / services / stats / stats.service.ts
index 255dbca..26fd1a3 100644 (file)
@@ -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);
           });
     }
 }