]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: support more form controls in CriticalConfirmationModalComponent
authorKiefer Chang <kiefer.chang@suse.com>
Tue, 26 May 2020 08:20:14 +0000 (16:20 +0800)
committerKiefer Chang <kiefer.chang@suse.com>
Mon, 8 Jun 2020 06:45:40 +0000 (14:45 +0800)
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts

index 3e2a2663b158434c6ab29e6779dd677305aabdbf..ed834b0897f71556ee2f4d09e7e24c7f8a03eec3 100644 (file)
@@ -25,6 +25,7 @@
           <ng-template #noNames>
             <p i18n>Are you sure that you want to {{ actionDescription | lowercase }} the selected {{ itemDescription }}?</p>
           </ng-template>
+          <ng-container *ngTemplateOutlet="childFormGroupTemplate; context:{form:deletionForm}"></ng-container>
           <div class="form-group">
             <div class="custom-control custom-checkbox">
               <input type="checkbox"
index 868c6d6ea42bd98eabb577e954938874f38115e1..90395214331f3b4b61d89851be12c8bb6abeb28b 100644 (file)
@@ -24,13 +24,19 @@ export class CriticalConfirmationModalComponent implements OnInit {
   itemNames: string[];
   actionDescription = 'delete';
 
+  childFormGroup: CdFormGroup;
+  childFormGroupTemplate: TemplateRef<any>;
+
   constructor(public modalRef: BsModalRef) {}
 
   ngOnInit() {
-    this.deletionForm = new CdFormGroup({
+    const controls = {
       confirmation: new FormControl(false, [Validators.requiredTrue])
-    });
-
+    };
+    if (this.childFormGroup) {
+      controls['child'] = this.childFormGroup;
+    }
+    this.deletionForm = new CdFormGroup(controls);
     if (!(this.submitAction || this.submitActionObservable)) {
       throw new Error('No submit action defined');
     }