From 6c8276c65cfbbd05f26393e5f75c5c91c7abcfe6 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Wed, 3 Mar 2021 00:10:34 +0200 Subject: [PATCH] fix(service-details): clear volume source when changing type (#4671) --- app/docker/views/services/edit/includes/mounts.html | 2 +- app/docker/views/services/edit/serviceController.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/docker/views/services/edit/includes/mounts.html b/app/docker/views/services/edit/includes/mounts.html index 49309e4d7..874c70d47 100644 --- a/app/docker/views/services/edit/includes/mounts.html +++ b/app/docker/views/services/edit/includes/mounts.html @@ -28,7 +28,7 @@ name="mountType" class="form-control" ng-model="mount.Type" - ng-change="updateMount(service, mount)" + ng-change="onChangeMountType(service, mount)" ng-disabled="isUpdating" disable-authorization="DockerServiceUpdate" > diff --git a/app/docker/views/services/edit/serviceController.js b/app/docker/views/services/edit/serviceController.js index b0a4932a6..f72c05dbb 100644 --- a/app/docker/views/services/edit/serviceController.js +++ b/app/docker/views/services/edit/serviceController.js @@ -209,6 +209,12 @@ angular.module('portainer.docker').controller('ServiceController', [ updateServiceArray(service, 'ServiceMounts', service.ServiceMounts); } }; + + $scope.onChangeMountType = function onChangeMountType(service, mount) { + mount.Source = null; + $scope.updateMount(service, mount); + }; + $scope.updateMount = function updateMount(service) { updateServiceArray(service, 'ServiceMounts', service.ServiceMounts); };