From 9edff075c5b70ac5580ad6324f902fa88ad16231 Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Mon, 2 Jul 2018 11:54:42 +0100 Subject: [PATCH] mgr/dashboard: Add 'onCancel' output for 'ConfirmationModal' Signed-off-by: Ricardo Marques --- .../confirmation-modal/confirmation-modal.component.html | 2 +- .../confirmation-modal/confirmation-modal.component.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.html index c8a49017b0bc4..c710cbf6b8cdc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.html @@ -19,7 +19,7 @@ + (click)="cancel()">Cancel diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts index bbb155bc011f8..92660376fa89e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts @@ -13,6 +13,7 @@ export class ConfirmationModalComponent implements OnInit { bodyTpl: TemplateRef; buttonText: string; onSubmit: Function; + onCancel: Function; titleText: string; bodyContext: object; @@ -32,6 +33,13 @@ export class ConfirmationModalComponent implements OnInit { this.onSubmit(); } + cancel() { + this.modalRef.hide(); + if (this.onCancel) { + this.onCancel(); + } + } + stopLoadingSpinner() { this.confirmationForm.setErrors({ cdSubmitButton: true }); } -- 2.39.5