]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
4c6135accfe564618be0de6fc60eb07760f0bf64
[ceph-ci.git] /
1 import { Component, Input, OnChanges } from '@angular/core';
2
3 import * as _ from 'lodash';
4
5 import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
6 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
7
8 @Component({
9   selector: 'cd-rgw-daemon-details',
10   templateUrl: './rgw-daemon-details.component.html',
11   styleUrls: ['./rgw-daemon-details.component.scss']
12 })
13 export class RgwDaemonDetailsComponent implements OnChanges {
14   metadata: any;
15   serviceId = '';
16
17   @Input()
18   selection: CdTableSelection;
19
20   constructor(private rgwDaemonService: RgwDaemonService) {}
21
22   ngOnChanges() {
23     // Get the service id of the first selected row.
24     if (this.selection.hasSelection) {
25       this.serviceId = this.selection.first().id;
26     }
27   }
28
29   getMetaData() {
30     if (_.isEmpty(this.serviceId)) {
31       return;
32     }
33     this.rgwDaemonService.get(this.serviceId).subscribe((resp) => {
34       this.metadata = resp['rgw_metadata'];
35     });
36   }
37 }