]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / osd / osd-details / osd-details.component.ts
CommitLineData
11fdf7f2
TL
1import { Component, Input, OnChanges } from '@angular/core';
2
3import * as _ from 'lodash';
4
5import { OsdService } from '../../../../shared/api/osd.service';
11fdf7f2
TL
6import { Permission } from '../../../../shared/models/permissions';
7import { AuthStorageService } from '../../../../shared/services/auth-storage.service';
8
9@Component({
10 selector: 'cd-osd-details',
11 templateUrl: './osd-details.component.html',
12 styleUrls: ['./osd-details.component.scss']
13})
14export class OsdDetailsComponent implements OnChanges {
15 @Input()
e306af50 16 selection: any;
11fdf7f2 17
9f95a23c
TL
18 osd: {
19 id?: number;
20 loaded?: boolean;
21 details?: any;
22 histogram_failed?: string;
23 tree?: any;
24 };
11fdf7f2
TL
25 grafanaPermission: Permission;
26
27 constructor(private osdService: OsdService, private authStorageService: AuthStorageService) {
28 this.grafanaPermission = this.authStorageService.getPermissions().grafana;
29 }
30
31 ngOnChanges() {
32 this.osd = {
33 loaded: false
34 };
e306af50
TL
35 if (this.selection) {
36 this.osd = this.selection;
11fdf7f2
TL
37 this.refresh();
38 }
39 }
40
41 refresh() {
9f95a23c 42 this.osdService.getDetails(this.osd.id).subscribe((data) => {
11fdf7f2
TL
43 this.osd.details = data;
44 this.osd.histogram_failed = '';
45 if (!_.isObject(data.histogram)) {
46 this.osd.histogram_failed = data.histogram;
47 this.osd.details.histogram = undefined;
48 }
49 this.osd.loaded = true;
50 });
51 }
52}