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