]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / crush-rule.service.ts
1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
3
4 import { I18n } from '@ngx-translate/i18n-polyfill';
5
6 import { CrushRuleConfig } from '../models/crush-rule';
7 import { ApiModule } from './api.module';
8
9 @Injectable({
10 providedIn: ApiModule
11 })
12 export class CrushRuleService {
13 apiPath = 'api/crush_rule';
14
15 formTooltips = {
16 // Copied from /doc/rados/operations/crush-map.rst
17 root: this.i18n(`The name of the node under which data should be placed.`),
18 failure_domain: this.i18n(`The type of CRUSH nodes across which we should separate replicas.`),
19 device_class: this.i18n(`The device class data should be placed on.`)
20 };
21
22 constructor(private http: HttpClient, private i18n: I18n) {}
23
24 create(rule: CrushRuleConfig) {
25 return this.http.post(this.apiPath, rule, { observe: 'response' });
26 }
27
28 delete(name: string) {
29 return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' });
30 }
31
32 getInfo() {
33 return this.http.get(`ui-${this.apiPath}/info`);
34 }
35 }