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 77 78 79 80 81 82 83 84 85 | 9x 9x 9x 9x 9x 23x 23x 23x 23x 36x 36x 11x 25x 25x 25x 25x 2x 2x 9x 1x 9x 11x 9x 4x 9x 1x 9x 1x 9x 1x 9x 1x 9x 1x 9x | import { HttpClient } from '@angular/common/http';
import { Injectable, NgZone } from '@angular/core';
import { BehaviorSubject, Subscription } from 'rxjs';
import { ApiModule } from './api.module';
@Injectable({
providedIn: ApiModule
})
export class RbdMirroringService {
// Observable sources
private summaryDataSource = new BehaviorSubject(null);
// Observable streams
summaryData$ = this.summaryDataSource.asObservable();
constructor(private http: HttpClient, private ngZone: NgZone) {
this.refreshAndSchedule();
}
refresh() {
this.http.get('api/block/mirroring/summary').subscribe((data) => {
this.summaryDataSource.next(data);
});
}
refreshAndSchedule() {
this.refresh();
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
this.ngZone.run(() => {
this.refreshAndSchedule();
});
}, 30000);
});
}
/**
* Returns the current value of summaryData
*/
getCurrentSummary(): { [key: string]: any; executing_tasks: object[] } {
return this.summaryDataSource.getValue();
}
/**
* Subscribes to the summaryData,
* which is updated once every 30 seconds or when a new task is created.
*/
subscribeSummary(next: (summary: any) => void, error?: (error: any) => void): Subscription {
return this.summaryData$.subscribe(next, error);
}
getPool(poolName) {
return this.http.get(`api/block/mirroring/pool/${poolName}`);
}
updatePool(poolName, request) {
return this.http.put(`api/block/mirroring/pool/${poolName}`, request, { observe: 'response' });
}
getPeer(poolName, peerUUID) {
return this.http.get(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`);
}
addPeer(poolName, request) {
return this.http.post(`api/block/mirroring/pool/${poolName}/peer`, request, {
observe: 'response'
});
}
updatePeer(poolName, peerUUID, request) {
return this.http.put(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`, request, {
observe: 'response'
});
}
deletePeer(poolName, peerUUID) {
return this.http.delete(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`, {
observe: 'response'
});
}
}
|