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()">
|
<form ng-submit="renameContainer()">
|
||||||
<input type="text" class="containerNameInput" ng-model="container.newContainerName" />
|
<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="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>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -207,17 +207,22 @@ angular.module('portainer.docker').controller('ContainerController', [
|
||||||
|
|
||||||
$scope.renameContainer = function () {
|
$scope.renameContainer = function () {
|
||||||
var container = $scope.container;
|
var container = $scope.container;
|
||||||
|
if (container.newContainerName === $filter('trimcontainername')(container.Name)) {
|
||||||
|
$scope.container.edit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
ContainerService.renameContainer($transition$.params().id, container.newContainerName)
|
ContainerService.renameContainer($transition$.params().id, container.newContainerName)
|
||||||
.then(function success() {
|
.then(function success() {
|
||||||
container.Name = container.newContainerName;
|
container.Name = container.newContainerName;
|
||||||
Notifications.success('Container successfully renamed', container.Name);
|
Notifications.success('Container successfully renamed', container.Name);
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
container.newContainerName = container.Name;
|
container.newContainerName = $filter('trimcontainername')(container.Name);
|
||||||
Notifications.error('Failure', err, 'Unable to rename container');
|
Notifications.error('Failure', err, 'Unable to rename container');
|
||||||
})
|
})
|
||||||
.finally(function final() {
|
.finally(function final() {
|
||||||
$scope.container.edit = false;
|
$scope.container.edit = false;
|
||||||
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue