mirror of https://github.com/portainer/portainer
EE-4021 fix(docker): rename deployed container (#7601)
parent
c0f3d0193d
commit
326a8abdc7
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue