1 import { Component, OnInit } from '@angular/core';
2 import { Validators } from '@angular/forms';
4 import { BsModalRef } from 'ngx-bootstrap/modal';
6 import { OsdService } from '../../../../shared/api/osd.service';
7 import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder';
8 import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
11 selector: 'cd-osd-reweight-modal',
12 templateUrl: './osd-reweight-modal.component.html',
13 styleUrls: ['./osd-reweight-modal.component.scss']
15 export class OsdReweightModalComponent implements OnInit {
18 reweightForm: CdFormGroup;
21 public bsModalRef: BsModalRef,
22 private osdService: OsdService,
23 private fb: CdFormBuilder
27 return this.reweightForm.get('weight');
31 this.reweightForm = this.fb.group({
32 weight: this.fb.control(this.currentWeight, [
42 .reweight(this.osdId, this.reweightForm.value.weight)
43 .subscribe(() => this.bsModalRef.hide());