File

src/app/shared/api/performance-counter.service.ts

Index

Properties
Methods

Constructor

constructor(http: HttpClient)
Parameters :
Name Type Optional
http HttpClient No

Methods

get
get(service_type: string, service_id: string)
Parameters :
Name Type Optional
service_type string No
service_id string No
Returns : any
list
list()
Returns : any

Properties

Private url
Type : string
Default value : 'api/perf_counters'
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { of as observableOf } from 'rxjs';
import { mergeMap } from 'rxjs/operators';

import { ApiModule } from './api.module';

@Injectable({
  providedIn: ApiModule
})
export class PerformanceCounterService {
  private url = 'api/perf_counters';

  constructor(private http: HttpClient) {}

  list() {
    return this.http.get(this.url);
  }

  get(service_type: string, service_id: string) {
    const serviceType = service_type.replace('-', '_');
    return this.http.get(`${this.url}/${serviceType}/${service_id}`).pipe(
      mergeMap((resp) => {
        return observableOf(resp['counters']);
      })
    );
  }
}

result-matching ""

    No results matching ""