# All files / src/app/ceph/rgw/rgw-daemon-details rgw-daemon-details.component.ts

76.19% Statements 16/21
70% Branches 7/10
50% Functions 2/4
77.78% Lines 14/18

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
    462x

    2x

    2x
    2x

    2x

    2x

    2x

    2x

    2x
    2x

    2x

    2x

    2x

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

    import * as _ from 'lodash';

    import { RgwDaemonService } from '../../../shared/api/rgw-daemon.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-rgw-daemon-details',
      template: require('./rgw-daemon-details.component.html'),
      styles: []
    })
    export class RgwDaemonDetailsComponent implements OnChanges {
      metadata: any;
      serviceId = '';
      grafanaPermission: Permission;

      @Input()
      selection: CdTableSelection;

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

      ngOnChanges() {
        // Get the service id of the first selected row.
        if (this.selection.hasSelection) {
          this.serviceId = this.selection.first().id;
        }
      }

      getMetaData() {
        if (_.isEmpty(this.serviceId)) {
          return;
        }
        this.rgwDaemonService.get(this.serviceId).subscribe((resp) => {
          this.metadata = resp['rgw_metadata'];
        });
      }
    }