]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / osd / osd-scrub-modal / osd-scrub-modal.component.ts
1 import { Component, OnInit } from '@angular/core';
2 import { FormGroup } from '@angular/forms';
3
4 import { I18n } from '@ngx-translate/i18n-polyfill';
5 import { BsModalRef } from 'ngx-bootstrap/modal';
6
7 import { OsdService } from '../../../../shared/api/osd.service';
8 import { NotificationType } from '../../../../shared/enum/notification-type.enum';
9 import { NotificationService } from '../../../../shared/services/notification.service';
10
11 @Component({
12 selector: 'cd-osd-scrub-modal',
13 templateUrl: './osd-scrub-modal.component.html',
14 styleUrls: ['./osd-scrub-modal.component.scss']
15 })
16 export class OsdScrubModalComponent implements OnInit {
17 deep: boolean;
18 selected = [];
19 scrubForm: FormGroup;
20
21 constructor(
22 public bsModalRef: BsModalRef,
23 private osdService: OsdService,
24 private notificationService: NotificationService,
25 private i18n: I18n
26 ) {}
27
28 ngOnInit() {
29 this.scrubForm = new FormGroup({});
30 }
31
32 scrub() {
33 const id = this.selected[0].id;
34
35 this.osdService.scrub(id, this.deep).subscribe(
36 () => {
37 const operation = this.deep ? 'Deep scrub' : 'Scrub';
38
39 this.notificationService.show(
40 NotificationType.success,
41 this.i18n('{{operation}} was initialized in the following OSD: {{id}}', {
42 operation: operation,
43 id: id
44 })
45 );
46
47 this.bsModalRef.hide();
48 },
49 () => {
50 this.bsModalRef.hide();
51 }
52 );
53 }
54 }