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
|
import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { Subscription } from 'rxjs';
import { RbdMirroringService } from '~/app/shared/api/rbd-mirroring.service';
import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
import { CephShortVersionPipe } from '~/app/shared/pipes/ceph-short-version.pipe';
@Component({
selector: 'cd-mirroring-daemons',
templateUrl: './daemon-list.component.html',
styleUrls: ['./daemon-list.component.scss']
})
export class DaemonListComponent implements OnInit, OnDestroy {
@ViewChild('healthTmpl', { static: true })
healthTmpl: TemplateRef<any>;
subs: Subscription;
data: [];
columns: {};
tableStatus = new TableStatusViewCache();
constructor(
private rbdMirroringService: RbdMirroringService,
private cephShortVersionPipe: CephShortVersionPipe
) {}
ngOnInit() {
this.columns = [
{ prop: 'instance_id', name: $localize`Instance`, flexGrow: 2 },
{ prop: 'id', name: $localize`ID`, flexGrow: 2 },
{ prop: 'server_hostname', name: $localize`Hostname`, flexGrow: 2 },
{
prop: 'version',
name: $localize`Version`,
pipe: this.cephShortVersionPipe,
flexGrow: 2
},
{
prop: 'health',
name: $localize`Health`,
cellTemplate: this.healthTmpl,
flexGrow: 1
}
];
this.subs = this.rbdMirroringService.subscribeSummary((data) => {
this.data = data.content_data.daemons;
this.tableStatus = new TableStatusViewCache(data.status);
});
}
ngOnDestroy(): void {
this.subs.unsubscribe();
}
refresh() {
this.rbdMirroringService.refresh();
}
}
|