Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 9x 9x 9x 9x 9x 9x 9x 153x 153x 9x 1x 9x 1x 1x 1x 1x 9x 1x 9x 1x 9x 1x 9x 1x 1x 2x 9x 1x 9x 3x 3x 3x 9x | import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { cdEncode } from '../decorators/cd-encode';
import { RbdConfigurationEntry } from '../models/configuration';
import { RbdConfigurationService } from '../services/rbd-configuration.service';
import { ApiModule } from './api.module';
@cdEncode
@Injectable({
providedIn: ApiModule
})
export class PoolService {
apiPath = 'api/pool';
constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {}
create(pool) {
return this.http.post(this.apiPath, pool, { observe: 'response' });
}
update(pool) {
let name: string;
Iif (pool.hasOwnProperty('srcpool')) {
name = pool.srcpool;
delete pool.srcpool;
} else {
name = pool.pool;
delete pool.pool;
}
return this.http.put(`${this.apiPath}/${encodeURIComponent(name)}`, pool, {
observe: 'response'
});
}
delete(name) {
return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' });
}
get(poolName) {
return this.http.get(`${this.apiPath}/${poolName}`);
}
getList() {
return this.http.get(`${this.apiPath}?stats=true`);
}
getConfiguration(poolName: string): Observable<RbdConfigurationEntry[]> {
return this.http.get<RbdConfigurationEntry[]>(`${this.apiPath}/${poolName}/configuration`).pipe(
// Add static data maintained in RbdConfigurationService
map((values) =>
values.map((entry) =>
Object.assign(entry, this.rbdConfigurationService.getOptionByName(entry.name))
)
)
);
}
getInfo(pool_name?: string) {
return this.http.get(`${this.apiPath}/_info` + (pool_name ? `?pool_name=${pool_name}` : ''));
}
list(attrs = []) {
const attrsStr = attrs.join(',');
return this.http
.get(`${this.apiPath}?attrs=${attrsStr}`)
.toPromise()
.then((resp: any) => {
return resp;
});
}
}
|