Call method to insert slashes in CAAS-Ingress URL
[portal/ric-dashboard.git] / webapp-frontend / src / app / services / dashboard / dashboard.service.ts
index 9a79f14..a9f2df6 100644 (file)
@@ -2,7 +2,7 @@
  * ========================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.
  */
 import { Injectable } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { DashboardSuccessTransport, EcompUser } from '../../interfaces/dashboard.types';
 
 @Injectable({
   providedIn: 'root'
 })
 
 /**
- * Services to query the dashboard's healthcheck controller.
+ * Services to query the dashboard's admin endpoints.
  */
 export class DashboardService {
 
-  private basePath = 'api/dashboard/';
+  private basePath = 'api/admin/';
 
   constructor(private httpClient: HttpClient) {
     // injects to variable httpClient
@@ -39,16 +41,24 @@ export class DashboardService {
    * Checks app health
    * @returns Observable that should yield a DashboardSuccessTransport
    */
-  getHealth() {
-    return this.httpClient.get(this.basePath + 'health');
+  getHealth(): Observable<DashboardSuccessTransport> {
+    return this.httpClient.get<DashboardSuccessTransport>(this.basePath + 'health');
   }
 
   /**
    * Gets Dashboard version details
    * @returns Observable that should yield a DashboardSuccessTransport object
    */
-  getVersion() {
-    return this.httpClient.get(this.basePath + 'version');
+  getVersion(): Observable<DashboardSuccessTransport> {
+    return this.httpClient.get<DashboardSuccessTransport>(this.basePath + 'version');
+  }
+
+  /**
+   * Gets Dashboard users
+   * @returns Observable that should yield a EcompUser array
+   */
+  getUsers(): Observable<EcompUser[]> {
+    return this.httpClient.get<EcompUser[]>(this.basePath + 'user');
   }
 
 }