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