]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts
import 15.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / mirroring / daemon-list / daemon-list.component.ts
CommitLineData
11fdf7f2
TL
1import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
2
3import { I18n } from '@ngx-translate/i18n-polyfill';
4import { Subscription } from 'rxjs';
5
6import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
7import { CephShortVersionPipe } from '../../../../shared/pipes/ceph-short-version.pipe';
8
9@Component({
10 selector: 'cd-mirroring-daemons',
11 templateUrl: './daemon-list.component.html',
12 styleUrls: ['./daemon-list.component.scss']
13})
14export class DaemonListComponent implements OnInit, OnDestroy {
9f95a23c 15 @ViewChild('healthTmpl', { static: true })
11fdf7f2
TL
16 healthTmpl: TemplateRef<any>;
17
18 subs: Subscription;
19
20 data: [];
21 columns: {};
22
23 constructor(
24 private rbdMirroringService: RbdMirroringService,
25 private cephShortVersionPipe: CephShortVersionPipe,
26 private i18n: I18n
27 ) {}
28
29 ngOnInit() {
30 this.columns = [
31 { prop: 'instance_id', name: this.i18n('Instance'), flexGrow: 2 },
32 { prop: 'id', name: this.i18n('ID'), flexGrow: 2 },
33 { prop: 'server_hostname', name: this.i18n('Hostname'), flexGrow: 2 },
34 {
35 prop: 'version',
36 name: this.i18n('Version'),
37 pipe: this.cephShortVersionPipe,
38 flexGrow: 2
39 },
40 {
41 prop: 'health',
42 name: this.i18n('Health'),
43 cellTemplate: this.healthTmpl,
44 flexGrow: 1
45 }
46 ];
47
f6b5b4d7 48 this.subs = this.rbdMirroringService.subscribeSummary((data) => {
11fdf7f2
TL
49 this.data = data.content_data.daemons;
50 });
51 }
52
53 ngOnDestroy(): void {
54 this.subs.unsubscribe();
55 }
56
57 refresh() {
58 this.rbdMirroringService.refresh();
59 }
60}