]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | import { HttpClient } from '@angular/common/http'; |
2 | import { Injectable } from '@angular/core'; | |
3 | ||
9f95a23c | 4 | import { CrushRuleConfig } from '../models/crush-rule'; |
9f95a23c TL |
5 | |
6 | @Injectable({ | |
f67539c2 | 7 | providedIn: 'root' |
9f95a23c TL |
8 | }) |
9 | export class CrushRuleService { | |
10 | apiPath = 'api/crush_rule'; | |
11 | ||
12 | formTooltips = { | |
13 | // Copied from /doc/rados/operations/crush-map.rst | |
f67539c2 TL |
14 | root: $localize`The name of the node under which data should be placed.`, |
15 | failure_domain: $localize`The type of CRUSH nodes across which we should separate replicas.`, | |
16 | device_class: $localize`The device class data should be placed on.` | |
9f95a23c TL |
17 | }; |
18 | ||
f67539c2 | 19 | constructor(private http: HttpClient) {} |
9f95a23c TL |
20 | |
21 | create(rule: CrushRuleConfig) { | |
22 | return this.http.post(this.apiPath, rule, { observe: 'response' }); | |
23 | } | |
24 | ||
25 | delete(name: string) { | |
26 | return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' }); | |
27 | } | |
28 | ||
29 | getInfo() { | |
30 | return this.http.get(`ui-${this.apiPath}/info`); | |
31 | } | |
32 | } |