From 326a8abdc716c2f41dcb6a60630cead212034e92 Mon Sep 17 00:00:00 2001 From: Rex Wang <109048808+RexWangPT@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:39:08 +0800 Subject: [PATCH] EE-4021 fix(docker): rename deployed container (#7601) --- app/docker/views/containers/edit/container.html | 2 +- app/docker/views/containers/edit/containerController.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/docker/views/containers/edit/container.html b/app/docker/views/containers/edit/container.html index f0cae974f..948926d65 100644 --- a/app/docker/views/containers/edit/container.html +++ b/app/docker/views/containers/edit/container.html @@ -80,7 +80,7 @@
diff --git a/app/docker/views/containers/edit/containerController.js b/app/docker/views/containers/edit/containerController.js index a3b0d7a05..df972416f 100644 --- a/app/docker/views/containers/edit/containerController.js +++ b/app/docker/views/containers/edit/containerController.js @@ -207,17 +207,22 @@ angular.module('portainer.docker').controller('ContainerController', [ $scope.renameContainer = function () { var container = $scope.container; + if (container.newContainerName === $filter('trimcontainername')(container.Name)) { + $scope.container.edit = false; + return; + } ContainerService.renameContainer($transition$.params().id, container.newContainerName) .then(function success() { container.Name = container.newContainerName; Notifications.success('Container successfully renamed', container.Name); }) .catch(function error(err) { - container.newContainerName = container.Name; + container.newContainerName = $filter('trimcontainername')(container.Name); Notifications.error('Failure', err, 'Unable to rename container'); }) .finally(function final() { $scope.container.edit = false; + $scope.$apply(); }); };