]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { Component, Input, OnChanges } from '@angular/core'; |
2 | ||
f67539c2 | 3 | import _ from 'lodash'; |
11fdf7f2 | 4 | |
f67539c2 TL |
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'; | |
11fdf7f2 TL |
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() | |
e306af50 | 20 | selection: any; |
11fdf7f2 TL |
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. | |
e306af50 TL |
31 | if (this.selection) { |
32 | this.serviceId = this.selection.id; | |
11fdf7f2 TL |
33 | } |
34 | } | |
35 | ||
36 | getMetaData() { | |
37 | if (_.isEmpty(this.serviceId)) { | |
38 | return; | |
39 | } | |
9f95a23c | 40 | this.rgwDaemonService.get(this.serviceId).subscribe((resp: any) => { |
11fdf7f2 TL |
41 | this.metadata = resp['rgw_metadata']; |
42 | }); | |
43 | } | |
44 | } |