1 import { Component, OnInit } from '@angular/core';
2 import { FormGroup } from '@angular/forms';
4 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
5 import { forkJoin } from 'rxjs';
7 import { OsdService } from '~/app/shared/api/osd.service';
8 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
9 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
10 import { JoinPipe } from '~/app/shared/pipes/join.pipe';
11 import { NotificationService } from '~/app/shared/services/notification.service';
14 selector: 'cd-osd-scrub-modal',
15 templateUrl: './osd-scrub-modal.component.html',
16 styleUrls: ['./osd-scrub-modal.component.scss']
18 export class OsdScrubModalComponent implements OnInit {
24 public activeModal: NgbActiveModal,
25 public actionLabels: ActionLabelsI18n,
26 private osdService: OsdService,
27 private notificationService: NotificationService,
28 private joinPipe: JoinPipe
32 this.scrubForm = new FormGroup({});
36 forkJoin(this.selected.map((id: any) => this.osdService.scrub(id, this.deep))).subscribe(
38 const operation = this.deep ? 'Deep scrub' : 'Scrub';
40 this.notificationService.show(
41 NotificationType.success,
42 $localize`${operation} was initialized in the following OSD(s): ${this.joinPipe.transform(
47 this.activeModal.close();
49 () => this.activeModal.close()