# All files / src/app/ceph/cephfs/cephfs-clients cephfs-clients.component.ts

80% Statements 16/20
71.43% Branches 5/7
50% Functions 2/4
81.25% Lines 13/16

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

    5x

    5x
    5x

    5x

    5x

    1x

    5x
    1x

    1x
    1x

    5x

    5x
     import { Component, Input, OnInit } from '@angular/core';

    import { I18n } from '@ngx-translate/i18n-polyfill';

    import { CephfsService } from '../../../shared/api/cephfs.service';
    import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';

    @Component({
      selector: 'cd-cephfs-clients',
      template: require('./cephfs-clients.component.html'),
      styles: []
    })
    export class CephfsClientsComponent implements OnInit {
      @Input()
      id: number;

      clients: any;
      viewCacheStatus: ViewCacheStatus;

      constructor(private cephfsService: CephfsService, private i18n: I18n) {}

      ngOnInit() {
        this.clients = {
          columns: [
            { prop: 'id', name: this.i18n('id') },
            { prop: 'type', name: this.i18n('type') },
            { prop: 'state', name: this.i18n('state') },
            { prop: 'version', name: this.i18n('version') },
            { prop: 'hostname', name: this.i18n('Host') },
            { prop: 'root', name: this.i18n('root') }
          ],
          data: []
        };

        this.clients.data = [];
        this.viewCacheStatus = ViewCacheStatus.ValueNone;
      }

      refresh() {
        this.cephfsService.getClients(this.id).subscribe((data: any) => {
          this.viewCacheStatus = data.status;
          this.clients.data = data.data;
        });
      }
    }