1 import { Component, Input, OnChanges } from '@angular/core';
3 import * as _ from 'lodash';
5 import { OsdService } from '../../../../shared/api/osd.service';
6 import { Permission } from '../../../../shared/models/permissions';
7 import { AuthStorageService } from '../../../../shared/services/auth-storage.service';
10 selector: 'cd-osd-details',
11 templateUrl: './osd-details.component.html',
12 styleUrls: ['./osd-details.component.scss']
14 export class OsdDetailsComponent implements OnChanges {
21 histogram_failed?: string;
24 grafanaPermission: Permission;
26 constructor(private osdService: OsdService, private authStorageService: AuthStorageService) {
27 this.grafanaPermission = this.authStorageService.getPermissions().grafana;
31 if (_.get(this, 'osd.id') !== _.get(this, 'selection.id')) {
32 this.osd = this.selection;
35 if (_.isNumber(_.get(this, 'osd.id'))) {
41 this.osdService.getDetails(this.osd.id).subscribe((data) => {
42 this.osd.details = data;
43 this.osd.histogram_failed = '';
44 if (!_.isObject(data.histogram)) {
45 this.osd.histogram_failed = data.histogram;
46 this.osd.details.histogram = undefined;