1 import { Component, OnInit } from '@angular/core';
2 import { Validators } from '@angular/forms';
4 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
6 import { OsdService } from '~/app/shared/api/osd.service';
7 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
8 import { CdFormBuilder } from '~/app/shared/forms/cd-form-builder';
9 import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
12 selector: 'cd-osd-reweight-modal',
13 templateUrl: './osd-reweight-modal.component.html',
14 styleUrls: ['./osd-reweight-modal.component.scss']
16 export class OsdReweightModalComponent implements OnInit {
19 reweightForm: CdFormGroup;
22 public actionLabels: ActionLabelsI18n,
23 public activeModal: NgbActiveModal,
24 private osdService: OsdService,
25 private fb: CdFormBuilder
29 return this.reweightForm.get('weight');
33 this.reweightForm = this.fb.group({
34 weight: this.fb.control(this.currentWeight, [
44 .reweight(this.osdId, this.reweightForm.value.weight)
45 .subscribe(() => this.activeModal.close());