feat(container-details): update re-creation flow (#2193)

pull/2197/head^2
Anthony Lapenna 2018-08-20 20:55:12 +02:00 committed by GitHub
parent 1b51daf9c4
commit 64beaaa279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -282,7 +282,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
return config; return config;
} }
function loadFromContainerCmd(d) { function loadFromContainerCmd(d) {
if ($scope.config.Cmd) { if ($scope.config.Cmd) {
$scope.config.Cmd = ContainerHelper.commandArrayToString($scope.config.Cmd); $scope.config.Cmd = ContainerHelper.commandArrayToString($scope.config.Cmd);
@ -374,7 +374,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
} else { } else {
$scope.formValues.MacAddress = ''; $scope.formValues.MacAddress = '';
} }
// ExtraHosts // ExtraHosts
if ($scope.config.HostConfig.ExtraHosts) { if ($scope.config.HostConfig.ExtraHosts) {
var extraHosts = $scope.config.HostConfig.ExtraHosts; var extraHosts = $scope.config.HostConfig.ExtraHosts;
@ -594,7 +594,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
function create() { function create() {
var oldContainer = null; var oldContainer = null;
HttpRequestHelper.setPortainerAgentTargetHeader($scope.formValues.NodeName); HttpRequestHelper.setPortainerAgentTargetHeader($scope.formValues.NodeName);
return findCurrentContainer() return findCurrentContainer()
.then(confirmCreateContainer) .then(confirmCreateContainer)
@ -631,8 +631,8 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
return $q.when(); return $q.when();
} }
$scope.state.actionInProgress = true; $scope.state.actionInProgress = true;
return stopAndRenameContainer(oldContainer) return pullImageIfNeeded()
.then(pullImageIfNeeded) .then(stopAndRenameContainer(oldContainer))
.then(createNewContainer) .then(createNewContainer)
.then(applyResourceControl) .then(applyResourceControl)
.then(connectToExtraNetworks) .then(connectToExtraNetworks)

View File

@ -196,9 +196,9 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.state.recreateContainerInProgress = true; $scope.state.recreateContainerInProgress = true;
var isRunning = container.State.Running; var isRunning = container.State.Running;
return stopContainerIfNeeded() return pullImageIfNeeded()
.then(stopContainerIfNeeded)
.then(renameContainer) .then(renameContainer)
.then(pullImageIfNeeded)
.then(setMainNetworkAndCreateContainer) .then(setMainNetworkAndCreateContainer)
.then(connectContainerToOtherNetworks) .then(connectContainerToOtherNetworks)
.then(startContainerIfNeeded) .then(startContainerIfNeeded)
@ -312,7 +312,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
function updateRestartPolicy(restartPolicy, maximumRetryCount) { function updateRestartPolicy(restartPolicy, maximumRetryCount) {
maximumRetryCount = restartPolicy === 'on-failure' ? maximumRetryCount : undefined; maximumRetryCount = restartPolicy === 'on-failure' ? maximumRetryCount : undefined;
return ContainerService return ContainerService
.updateRestartPolicy($scope.container.Id, restartPolicy, maximumRetryCount) .updateRestartPolicy($scope.container.Id, restartPolicy, maximumRetryCount)
.then(onUpdateSuccess) .then(onUpdateSuccess)