From 60c5ab3eecb0ba3c8ed7334702e1da7d8c37849c Mon Sep 17 00:00:00 2001 From: Maxime Bajeux Date: Thu, 10 Dec 2020 08:46:58 +0100 Subject: [PATCH] feat(kube): Add a confirmation modal before deleting one or more application or configuration (#4522) --- .../views/applications/applicationsController.js | 6 +++++- .../views/configurations/configurationsController.js | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/kubernetes/views/applications/applicationsController.js b/app/kubernetes/views/applications/applicationsController.js index cfda16093..1f8b137be 100644 --- a/app/kubernetes/views/applications/applicationsController.js +++ b/app/kubernetes/views/applications/applicationsController.js @@ -79,7 +79,11 @@ class KubernetesApplicationsController { } removeAction(selectedItems) { - return this.$async(this.removeActionAsync, selectedItems); + this.ModalService.confirmDeletion('Do you want to remove the selected application(s)?', (confirmed) => { + if (confirmed) { + return this.$async(this.removeActionAsync, selectedItems); + } + }); } onPublishingModeClick(application) { diff --git a/app/kubernetes/views/configurations/configurationsController.js b/app/kubernetes/views/configurations/configurationsController.js index eb94722fe..7b08ea670 100644 --- a/app/kubernetes/views/configurations/configurationsController.js +++ b/app/kubernetes/views/configurations/configurationsController.js @@ -3,12 +3,13 @@ import KubernetesConfigurationHelper from 'Kubernetes/helpers/configurationHelpe class KubernetesConfigurationsController { /* @ngInject */ - constructor($async, $state, Notifications, KubernetesConfigurationService, KubernetesApplicationService) { + constructor($async, $state, Notifications, KubernetesConfigurationService, KubernetesApplicationService, ModalService) { this.$async = $async; this.$state = $state; this.Notifications = Notifications; this.KubernetesConfigurationService = KubernetesConfigurationService; this.KubernetesApplicationService = KubernetesApplicationService; + this.ModalService = ModalService; this.onInit = this.onInit.bind(this); this.getConfigurations = this.getConfigurations.bind(this); @@ -56,7 +57,11 @@ class KubernetesConfigurationsController { } removeAction(selectedItems) { - return this.$async(this.removeActionAsync, selectedItems); + this.ModalService.confirmDeletion('Do you want to remove the selected configuration(s)?', (confirmed) => { + if (confirmed) { + return this.$async(this.removeActionAsync, selectedItems); + } + }); } async getApplicationsAsync() {