]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / critical-confirmation-modal / critical-confirmation-modal.component.ts
index 4c634f8ca2559b3be7423104f3c32ede94484eb2..406f992a9df22a7aeed2ea3264044b8023e013d1 100644 (file)
@@ -1,5 +1,5 @@
 import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { FormControl, Validators } from '@angular/forms';
+import { UntypedFormControl, Validators } from '@angular/forms';
 
 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 import { Observable } from 'rxjs';
@@ -18,7 +18,9 @@ export class CriticalConfirmationModalComponent implements OnInit {
   bodyTemplate: TemplateRef<any>;
   bodyContext: object;
   submitActionObservable: () => Observable<any>;
+  callBackAtionObservable: () => Observable<any>;
   submitAction: Function;
+  backAction: Function;
   deletionForm: CdFormGroup;
   itemDescription: 'entry';
   itemNames: string[];
@@ -31,7 +33,7 @@ export class CriticalConfirmationModalComponent implements OnInit {
 
   ngOnInit() {
     const controls = {
-      confirmation: new FormControl(false, [Validators.requiredTrue])
+      confirmation: new UntypedFormControl(false, [Validators.requiredTrue])
     };
     if (this.childFormGroup) {
       controls['child'] = this.childFormGroup;
@@ -53,6 +55,17 @@ export class CriticalConfirmationModalComponent implements OnInit {
     }
   }
 
+  callBackAction() {
+    if (this.callBackAtionObservable) {
+      this.callBackAtionObservable().subscribe({
+        error: this.stopLoadingSpinner.bind(this),
+        complete: this.hideModal.bind(this)
+      });
+    } else {
+      this.backAction();
+    }
+  }
+
   hideModal() {
     this.activeModal.close();
   }