# All files / src/app/ceph/cluster/osd/osd-details osd-details.component.ts

92% Statements 23/25
70% Branches 7/10
100% Functions 4/4
90.48% Lines 19/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    486x

    6x

    6x
    6x

    6x

    6x

    6x

    12x
    12x

    6x
    9x

    6x
    2x
    2x
    2x

    1x
    1x

    2x

    6x
     import { Component, Input, OnChanges } from '@angular/core';

    import * as _ from 'lodash';

    import { OsdService } from '../../../../shared/api/osd.service';
    import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
    import { Permission } from '../../../../shared/models/permissions';
    import { AuthStorageService } from '../../../../shared/services/auth-storage.service';

    @Component({
      selector: 'cd-osd-details',
      template: require('./osd-details.component.html'),
      styles: []
    })
    export class OsdDetailsComponent implements OnChanges {
      @Input()
      selection: CdTableSelection;

      osd: any;
      grafanaPermission: Permission;

      constructor(private osdService: OsdService, private authStorageService: AuthStorageService) {
        this.grafanaPermission = this.authStorageService.getPermissions().grafana;
      }

      ngOnChanges() {
        this.osd = {
          loaded: false
        };
        if (this.selection.hasSelection) {
          this.osd = this.selection.first();
          this.refresh();
        }
      }

      refresh() {
        this.osdService.getDetails(this.osd.id).subscribe((data: any) => {
          this.osd.details = data;
          this.osd.histogram_failed = '';
          if (!_.isObject(data.histogram)) {
            this.osd.histogram_failed = data.histogram;
            this.osd.details.histogram = undefined;
          }
          this.osd.loaded = true;
        });
      }
    }