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

100% Statements 27/27
66.67% Branches 4/6
100% Functions 3/3
100% Lines 25/25

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
    48
    496x

    6x

    6x

    6x

    6x

    26x

    6x

    3x
    3x
    3x
    3x
    3x
    6x

    3x
    3x
    3x
    3x
    3x

    2x
    2x
    2x
    2x

    1x
    1x

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

    import { I18n } from '@ngx-translate/i18n-polyfill';
    import * as _ from 'lodash';

    import { CdTableSelection } from '../../../shared/models/cd-table-selection';

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

      selectedItem: any;
      data: any;

      constructor(private i18n: I18n) {}

      ngOnChanges() {
        if (this.selection.hasSelection) {
          this.selectedItem = this.selection.first();
          this.data = {};
          this.data[this.i18n('Cluster')] = this.selectedItem.cluster_id;
          this.data[this.i18n('Daemons')] = this.selectedItem.daemons;
          this.data[this.i18n('NFS Protocol')] = this.selectedItem.protocols.map(
            (protocol) => 'NFSv' + protocol
          );
          this.data[this.i18n('Pseudo')] = this.selectedItem.pseudo;
          this.data[this.i18n('Access Type')] = this.selectedItem.access_type;
          this.data[this.i18n('Squash')] = this.selectedItem.squash;
          this.data[this.i18n('Transport')] = this.selectedItem.transports;
          this.data[this.i18n('Path')] = this.selectedItem.path;

          if (this.selectedItem.fsal.name === 'CEPH') {
            this.data[this.i18n('Storage Backend')] = this.i18n('CephFS');
            this.data[this.i18n('CephFS User')] = this.selectedItem.fsal.user_id;
            this.data[this.i18n('CephFS Filesystem')] = this.selectedItem.fsal.fs_name;
            this.data[this.i18n('Security Label')] = this.selectedItem.fsal.sec_label_xattr;
          } else {
            this.data[this.i18n('Storage Backend')] = this.i18n('Object Gateway');
            this.data[this.i18n('Object Gateway User')] = this.selectedItem.fsal.rgw_user_id;
          }
        }
      }
    }