EE-4021 fix(docker): rename deployed container (#7601)

pull/7619/head
Rex Wang 2022-09-05 17:39:08 +08:00 committed by GitHub
parent c0f3d0193d
commit 326a8abdc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -80,7 +80,7 @@
<form ng-submit="renameContainer()">
<input type="text" class="containerNameInput" ng-model="container.newContainerName" />
<a href="" ng-click="container.edit = false;"><i class="fa fa-times"></i></a>
<a href="" ng-click="renameContainer()"><i class="fa fa-check-square"></i></a>
<a href="" ng-click="renameContainer()"><i class="fa fa-check"></i></a>
</form>
</td>
</tr>

View File

@ -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();
});
};