From 829ff5da73e392b5c751f1711226344673436ec2 Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Sat, 7 Feb 2015 23:02:35 +0100 Subject: [PATCH 1/3] fixed loss of hostconfig when starting with batch --- app/components/containers/containersController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js index 7d26cba87..089c28f9f 100644 --- a/app/components/containers/containersController.js +++ b/app/components/containers/containersController.js @@ -27,7 +27,7 @@ function($scope, Container, Settings, Messages, ViewSpinner) { angular.forEach(items, function(c) { if (c.Checked) { counter = counter + 1; - action({id: c.Id}, function(d) { + action({id: c.Id, HostConfig: c.HostConfig}, function(d) { Messages.send("Container " + msg, c.Id); var index = $scope.containers.indexOf(c); complete(); From dabb1926a52a39e9776c901b79583307c5a4ca90 Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Sun, 8 Feb 2015 19:59:26 +0100 Subject: [PATCH 2/3] fixed all HostConfigs being lost when starting from the list --- .../containers/containersController.js | 44 ++++++++++++++---- dist/dockerui.js | 46 +++++++++++++++---- 2 files changed, 71 insertions(+), 19 deletions(-) diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js index 089c28f9f..a57317ee1 100644 --- a/app/components/containers/containersController.js +++ b/app/components/containers/containersController.js @@ -26,15 +26,41 @@ function($scope, Container, Settings, Messages, ViewSpinner) { }; angular.forEach(items, function(c) { if (c.Checked) { - counter = counter + 1; - action({id: c.Id, HostConfig: c.HostConfig}, function(d) { - Messages.send("Container " + msg, c.Id); - var index = $scope.containers.indexOf(c); - complete(); - }, function(e) { - Messages.error("Failure", e.data); - complete(); - }); + if(msg === "Started"){ + Container.get({id: c.Id}, function(d) { + c = d; + counter = counter + 1; + action({id: c.Id, HostConfig: c.HostConfig || {}}, function(d) { + Messages.send("Container " + msg, c.Id); + var index = $scope.containers.indexOf(c); + complete(); + }, function(e) { + Messages.error("Failure", e.data); + complete(); + }); + }, function(e) { + if (e.status === 404) { + $('.detail').hide(); + Messages.error("Not found", "Container not found."); + } else { + Messages.error("Failure", e.data); + } + complete(); + }); + } + else{ + counter = counter + 1; + action({id: c.Id}, function(d) { + Messages.send("Container " + msg, c.Id); + var index = $scope.containers.indexOf(c); + complete(); + }, function(e) { + Messages.error("Failure", e.data); + complete(); + }); + + } + } }); if (counter === 0) { diff --git a/dist/dockerui.js b/dist/dockerui.js index adb915903..27762939e 100644 --- a/dist/dockerui.js +++ b/dist/dockerui.js @@ -1,4 +1,4 @@ -/*! dockerui - v0.6.0 - 2015-02-01 +/*! dockerui - v0.6.0 - 2015-02-08 * https://github.com/crosbymichael/dockerui * Copyright (c) 2015 Michael Crosby & Kevan Ahlquist; * Licensed MIT @@ -211,15 +211,41 @@ function($scope, Container, Settings, Messages, ViewSpinner) { }; angular.forEach(items, function(c) { if (c.Checked) { - counter = counter + 1; - action({id: c.Id}, function(d) { - Messages.send("Container " + msg, c.Id); - var index = $scope.containers.indexOf(c); - complete(); - }, function(e) { - Messages.error("Failure", e.data); - complete(); - }); + if(msg === "Started"){ + Container.get({id: c.Id}, function(d) { + c = d; + counter = counter + 1; + action({id: c.Id, HostConfig: c.HostConfig || {}}, function(d) { + Messages.send("Container " + msg, c.Id); + var index = $scope.containers.indexOf(c); + complete(); + }, function(e) { + Messages.error("Failure", e.data); + complete(); + }); + }, function(e) { + if (e.status === 404) { + $('.detail').hide(); + Messages.error("Not found", "Container not found."); + } else { + Messages.error("Failure", e.data); + } + complete(); + }); + } + else{ + counter = counter + 1; + action({id: c.Id}, function(d) { + Messages.send("Container " + msg, c.Id); + var index = $scope.containers.indexOf(c); + complete(); + }, function(e) { + Messages.error("Failure", e.data); + complete(); + }); + + } + } }); if (counter === 0) { From 8abb445bd413d0d7a9ce4aa4f89196367ae2dfce Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Mon, 9 Feb 2015 20:06:28 +0100 Subject: [PATCH 3/3] nicer solution for checking the action --- app/components/containers/containersController.js | 2 +- dist/dockerui.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js index a57317ee1..08bd74def 100644 --- a/app/components/containers/containersController.js +++ b/app/components/containers/containersController.js @@ -26,7 +26,7 @@ function($scope, Container, Settings, Messages, ViewSpinner) { }; angular.forEach(items, function(c) { if (c.Checked) { - if(msg === "Started"){ + if(action === Container.start){ Container.get({id: c.Id}, function(d) { c = d; counter = counter + 1; diff --git a/dist/dockerui.js b/dist/dockerui.js index 27762939e..55d37182d 100644 --- a/dist/dockerui.js +++ b/dist/dockerui.js @@ -1,4 +1,4 @@ -/*! dockerui - v0.6.0 - 2015-02-08 +/*! dockerui - v0.6.0 - 2015-02-09 * https://github.com/crosbymichael/dockerui * Copyright (c) 2015 Michael Crosby & Kevan Ahlquist; * Licensed MIT @@ -211,7 +211,7 @@ function($scope, Container, Settings, Messages, ViewSpinner) { }; angular.forEach(items, function(c) { if (c.Checked) { - if(msg === "Started"){ + if(action === Container.start){ Container.get({id: c.Id}, function(d) { c = d; counter = counter + 1;