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