]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
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 | import { Permission } from '../../../shared/models/permissions'; | |
8 | import { 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 | }) | |
15 | export 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 | } |