1 import { Component, OnInit } from '@angular/core';
2 import { FormGroup } from '@angular/forms';
4 import { I18n } from '@ngx-translate/i18n-polyfill';
5 import { BsModalRef } from 'ngx-bootstrap/modal';
6 import { forkJoin } from 'rxjs';
8 import { OsdService } from '../../../../shared/api/osd.service';
9 import { NotificationType } from '../../../../shared/enum/notification-type.enum';
10 import { JoinPipe } from '../../../../shared/pipes/join.pipe';
11 import { NotificationService } from '../../../../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 bsModalRef: BsModalRef,
25 private osdService: OsdService,
26 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 this.i18n('{{operation}} was initialized in the following OSD(s): {{id}}', {
44 id: this.joinPipe.transform(this.selected)
48 this.bsModalRef.hide();
50 () => this.bsModalRef.hide()