]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
4d60308646da69f93ff3a21ecaaa62495ddfc80e
[ceph.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() selection: CdTableSelection;
18
19   constructor(private rgwDaemonService: RgwDaemonService) {}
20
21   ngOnChanges() {
22     // Get the service id of the first selected row.
23     if (this.selection.hasSelection) {
24       this.serviceId = this.selection.first().id;
25     }
26   }
27
28   getMetaData() {
29     if (_.isEmpty(this.serviceId)) {
30       return;
31     }
32     this.rgwDaemonService.get(this.serviceId).subscribe((resp) => {
33       this.metadata = resp['rgw_metadata'];
34     });
35   }
36 }