]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / confirmation-modal / confirmation-modal.component.ts
1 import { Component, OnInit, TemplateRef } from '@angular/core';
2 import { FormGroup } from '@angular/forms';
3
4 import { BsModalRef } from 'ngx-bootstrap/modal';
5
6 @Component({
7 selector: 'cd-confirmation-modal',
8 templateUrl: './confirmation-modal.component.html',
9 styleUrls: ['./confirmation-modal.component.scss']
10 })
11 export class ConfirmationModalComponent implements OnInit {
12 bodyData: object;
13 bodyTpl: TemplateRef<any>;
14 buttonText: string;
15 onSubmit: Function;
16 onCancel: Function;
17 titleText: string;
18
19 bodyContext: object;
20 confirmationForm: FormGroup;
21
22 boundCancel = this.cancel.bind(this);
23
24 constructor(public modalRef: BsModalRef) {
25 this.confirmationForm = new FormGroup({});
26 }
27
28 ngOnInit() {
29 this.bodyContext = this.bodyContext || {};
30 this.bodyContext['$implicit'] = this.bodyData;
31 }
32
33 cancel() {
34 this.modalRef.hide();
35 if (this.onCancel) {
36 this.onCancel();
37 }
38 }
39
40 stopLoadingSpinner() {
41 this.confirmationForm.setErrors({ cdSubmitButton: true });
42 }
43 }