},
onSubmit: () => {
observableForkJoin(
- this.getSelectedIds().map((osd: any) => {
- onSubmit.call(this.osdService, osd).subscribe(() => this.bsModalRef.hide());
- })
- );
+ this.getSelectedIds().map((osd: any) => onSubmit.call(this.osdService, osd))
+ ).subscribe(() => this.bsModalRef.hide());
}
}
});
},
submitAction: () => {
observableForkJoin(
- this.getSelectedIds().map((osd: any) => {
- action.call(this.osdService, osd).subscribe(() => modalRef.hide());
- })
+ this.getSelectedIds().map((osd: any) => action.call(this.osdService, osd))
+ ).subscribe(
+ () => {
+ modalRef.hide();
+ },
+ () => modalRef.hide()
);
}
}
import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef } from 'ngx-bootstrap/modal';
+import { forkJoin } from 'rxjs';
import { OsdService } from '../../../../shared/api/osd.service';
import { NotificationType } from '../../../../shared/enum/notification-type.enum';
}
scrub() {
- for (const id of this.selected) {
- this.osdService.scrub(id, this.deep).subscribe(
- () => {
- const operation = this.deep ? 'Deep scrub' : 'Scrub';
-
- this.notificationService.show(
- NotificationType.success,
- this.i18n('{{operation}} was initialized in the following OSD(s): {{id}}', {
- operation: operation,
- id: this.listPipe.transform(this.selected)
- })
- );
- this.bsModalRef.hide();
- },
- () => {
- this.bsModalRef.hide();
- }
- );
- }
+ forkJoin(this.selected.map((id: any) => this.osdService.scrub(id, this.deep))).subscribe(
+ () => {
+ const operation = this.deep ? 'Deep scrub' : 'Scrub';
+
+ this.notificationService.show(
+ NotificationType.success,
+ this.i18n('{{operation}} was initialized in the following OSD(s): {{id}}', {
+ operation: operation,
+ id: this.listPipe.transform(this.selected)
+ })
+ );
+
+ this.bsModalRef.hide();
+ },
+ () => this.bsModalRef.hide()
+ );
}
}