diff --git a/app/kubernetes/registries/kube-registry-access-view/kube-registry-access-view.controller.js b/app/kubernetes/registries/kube-registry-access-view/kube-registry-access-view.controller.js
index 9367f5aef..97db67ae8 100644
--- a/app/kubernetes/registries/kube-registry-access-view/kube-registry-access-view.controller.js
+++ b/app/kubernetes/registries/kube-registry-access-view/kube-registry-access-view.controller.js
@@ -2,9 +2,10 @@ import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
export default class KubernetesRegistryAccessController {
/* @ngInject */
- constructor($async, $state, EndpointService, Notifications, KubernetesResourcePoolService) {
+ constructor($async, $state, ModalService, EndpointService, Notifications, KubernetesResourcePoolService) {
this.$async = $async;
this.$state = $state;
+ this.ModalService = ModalService;
this.Notifications = Notifications;
this.KubernetesResourcePoolService = KubernetesResourcePoolService;
this.EndpointService = EndpointService;
@@ -26,8 +27,15 @@ export default class KubernetesRegistryAccessController {
handleRemove(namespaces) {
const removeNamespaces = namespaces.map(({ value }) => value);
+ const nsToUpdate = this.savedResourcePools.map(({ value }) => value).filter((value) => !removeNamespaces.includes(value));
- return this.updateNamespaces(this.savedResourcePools.map(({ value }) => value).filter((value) => !removeNamespaces.includes(value)));
+ const displayedMessage =
+ 'This registry might be used by one or more applications inside this environment. Removing the registry access could lead to a service interruption for these applications.
Do you wish to continue?';
+ this.ModalService.confirmDeletion(displayedMessage, (confirmed) => {
+ if (confirmed) {
+ return this.updateNamespaces(nsToUpdate);
+ }
+ });
}
updateNamespaces(namespaces) {
diff --git a/app/kubernetes/views/resource-pools/edit/resourcePoolController.js b/app/kubernetes/views/resource-pools/edit/resourcePoolController.js
index 1fe6e844d..f611a5b9d 100644
--- a/app/kubernetes/views/resource-pools/edit/resourcePoolController.js
+++ b/app/kubernetes/views/resource-pools/edit/resourcePoolController.js
@@ -185,20 +185,26 @@ class KubernetesResourcePoolController {
}
updateResourcePool() {
- const willBeDeleted = _.filter(this.formValues.IngressClasses, { WasSelected: true, Selected: false });
+ const ingressesToDelete = _.filter(this.formValues.IngressClasses, { WasSelected: true, Selected: false });
+ const registriesToDelete = _.filter(this.registries, { WasChecked: true, Checked: false });
const warnings = {
quota: this.hasResourceQuotaBeenReduced(),
- ingress: willBeDeleted.length !== 0,
+ ingress: ingressesToDelete.length !== 0,
+ registries: registriesToDelete.length !== 0,
};
- if (warnings.quota || warnings.ingress) {
+ if (warnings.quota || warnings.ingress || warnings.registries) {
const messages = {
quota:
'Reducing the quota assigned to an "in-use" namespace may have unintended consequences, including preventing running applications from functioning correctly and potentially even blocking them from running at all.',
ingress: 'Deactivating ingresses may cause applications to be unaccessible. All ingress configurations from affected applications will be removed.',
+ registries:
+ 'Some registries you removed might be used by one or more applications inside this environment. Removing the registries access could lead to a service interruption for these applications.',
};
- const displayedMessage = `${warnings.quota ? messages.quota : ''}${warnings.quota && warnings.ingress ? '
' : ''}
- ${warnings.ingress ? messages.ingress : ''}
Do you wish to continue?`;
+ const displayedMessage = `${warnings.quota ? messages.quota + '
' : ''}
+ ${warnings.ingress ? messages.ingress + '
' : ''}
+ ${warnings.registries ? messages.registries + '
' : ''}
+ Do you wish to continue?`;
this.ModalService.confirmUpdate(displayedMessage, (confirmed) => {
if (confirmed) {
return this.$async(this.updateResourcePoolAsync, this.savedFormValues, this.formValues);
@@ -322,6 +328,7 @@ class KubernetesResourcePoolController {
this.registries.forEach((reg) => {
if (reg.RegistryAccesses && reg.RegistryAccesses[this.endpoint.Id] && reg.RegistryAccesses[this.endpoint.Id].Namespaces.includes(namespace)) {
reg.Checked = true;
+ reg.WasChecked = true;
this.formValues.Registries.push(reg);
}
});
diff --git a/app/portainer/views/registries/registriesController.js b/app/portainer/views/registries/registriesController.js
index 83e3cbafc..568516de7 100644
--- a/app/portainer/views/registries/registriesController.js
+++ b/app/portainer/views/registries/registriesController.js
@@ -21,7 +21,11 @@ angular.module('portainer.app').controller('RegistriesController', [
};
$scope.removeAction = function (selectedItems) {
- ModalService.confirmDeletion('Do you want to remove the selected registries?', function onConfirm(confirmed) {
+ const regAttrMsg = selectedItems.length > 1 ? 'hese' : 'his';
+ const registriesMsg = selectedItems.length > 1 ? 'registries' : 'registry';
+ const msg = `T${regAttrMsg} ${registriesMsg} might be used by applications inside one or more endpoints. Removing the ${registriesMsg} could lead to a service interruption for the applications using t${regAttrMsg} ${registriesMsg}. Do you want to remove the selected ${registriesMsg}?`;
+
+ ModalService.confirmDeletion(msg, function onConfirm(confirmed) {
if (!confirmed) {
return;
}