All files / src/app/ceph/block/iscsi-setting iscsi-setting.component.ts

100% Statements 18/18
66.67% Branches 8/12
100% Functions 2/2
100% Lines 16/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 325x 5x   5x             5x   5x   5x   5x   5x   5x 16x 16x 16x   16x 16x   16x   5x  
import { Component, Input, OnInit } from '@angular/core';
import { NgForm, Validators } from '@angular/forms';
 
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
 
@Component({
  selector: 'cd-iscsi-setting',
  template: require('./iscsi-setting.component.html'),
  styles: []
})
export class IscsiSettingComponent implements OnInit {
  @Input()
  settingsForm: CdFormGroup;
  @Input()
  formDir: NgForm;
  @Input()
  setting: string;
  @Input()
  limits: object;
 
  ngOnInit() {
    const validators = [];
    Eif ('min' in this.limits) {
      validators.push(Validators.min(this.limits['min']));
    }
    Eif ('max' in this.limits) {
      validators.push(Validators.max(this.limits['max']));
    }
    this.settingsForm.get(this.setting).setValidators(validators);
  }
}