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

90.91% Statements 20/22
68.75% Branches 11/16
66.67% Functions 2/3
88.89% Lines 16/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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    734x

    4x
    4x

    4x

    4x

    4x

    4x
    28x

    4x

    4x

    4x

    4x

    28x
    28x

    23x

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

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

    import { PoolService } from '../../../shared/api/pool.service';
    import { CdTableColumn } from '../../../shared/models/cd-table-column';
    import { CdTableSelection } from '../../../shared/models/cd-table-selection';
    import { RbdConfigurationEntry } from '../../../shared/models/configuration';
    import { Permissions } from '../../../shared/models/permissions';

    @Component({
      selector: 'cd-pool-details',
      template: require('./pool-details.component.html'),
      styles: []
    })
    export class PoolDetailsComponent implements OnChanges {
      cacheTierColumns: Array<CdTableColumn> = [];

      @Input()
      selection: CdTableSelection;
      @Input()
      permissions: Permissions;
      @Input()
      cacheTiers: any[];
      @ViewChild(TabsetComponent)
      tabsetChild: TabsetComponent;
      selectedPoolConfiguration: RbdConfigurationEntry[];

      constructor(private i18n: I18n, private poolService: PoolService) {
        this.cacheTierColumns = [
          {
            prop: 'pool_name',
            name: this.i18n('Name'),
            flexGrow: 3
          },
          {
            prop: 'cache_mode',
            name: this.i18n('Cache Mode'),
            flexGrow: 2
          },
          {
            prop: 'cache_min_evict_age',
            name: this.i18n('Min Evict Age'),
            flexGrow: 2
          },
          {
            prop: 'cache_min_flush_age',
            name: this.i18n('Min Flush Age'),
            flexGrow: 2
          },
          {
            prop: 'target_max_bytes',
            name: this.i18n('Target Max Bytes'),
            flexGrow: 2
          },
          {
            prop: 'target_max_objects',
            name: this.i18n('Target Max Objects'),
            flexGrow: 2
          }
        ];
      }

      ngOnChanges() {
        if (this.selection.hasSingleSelection) {
          this.poolService.getConfiguration(this.selection.first().pool_name).subscribe((poolConf) => {
            this.selectedPoolConfiguration = poolConf;
          });
        }
      }
    }