]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts
7eaae7aa0243717f619289c9a745d77eb4b50f19
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / mirroring / daemon-list / daemon-list.component.ts
1 import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
2
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4 import { Subscription } from 'rxjs';
5
6 import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
7 import { 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 })
14 export class DaemonListComponent implements OnInit, OnDestroy {
15 @ViewChild('healthTmpl', { static: true })
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
48 this.subs = this.rbdMirroringService.subscribeSummary((data) => {
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 }