]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/ceph-service.service.ts
bump version to 15.2.1-pve1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / ceph-service.service.ts
1 import { HttpClient, HttpParams } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
3
4 import { Observable } from 'rxjs';
5
6 import { Daemon } from '../models/daemon.interface';
7 import { CephService } from '../models/service.interface';
8 import { ApiModule } from './api.module';
9
10 @Injectable({
11 providedIn: ApiModule
12 })
13 export class CephServiceService {
14 private url = 'api/service';
15
16 constructor(private http: HttpClient) {}
17
18 list(serviceName?: string): Observable<CephService[]> {
19 const options = serviceName
20 ? { params: new HttpParams().set('service_name', serviceName) }
21 : {};
22 return this.http.get<CephService[]>(this.url, options);
23 }
24
25 getDaemons(serviceName?: string): Observable<Daemon[]> {
26 return this.http.get<Daemon[]>(`${this.url}/${serviceName}/daemons`);
27 }
28 }