mirror of https://github.com/portainer/portainer
Fixed Cmd parsing for strings, added error handling to start step.
parent
314fc51f6d
commit
687ed7bac2
|
@ -54,6 +54,8 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
|
|
||||||
if (config.Cmd && config.Cmd[0] === "[") {
|
if (config.Cmd && config.Cmd[0] === "[") {
|
||||||
config.Cmd = angular.fromJson(config.Cmd);
|
config.Cmd = angular.fromJson(config.Cmd);
|
||||||
|
} else if (config.Cmd) {
|
||||||
|
config.Cmd = config.Cmd.split(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Env = config.Env.map(function(envar) {return envar.name + '=' + envar.value;});
|
config.Env = config.Env.map(function(envar) {return envar.name + '=' + envar.value;});
|
||||||
|
@ -71,7 +73,6 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
|
|
||||||
var ExposedPorts = {};
|
var ExposedPorts = {};
|
||||||
var PortBindings = {};
|
var PortBindings = {};
|
||||||
// TODO: consider using compatibility library
|
|
||||||
config.HostConfig.PortBindings.forEach(function(portBinding) {
|
config.HostConfig.PortBindings.forEach(function(portBinding) {
|
||||||
var intPort = portBinding.intPort + "/tcp";
|
var intPort = portBinding.intPort + "/tcp";
|
||||||
var binding = {
|
var binding = {
|
||||||
|
@ -86,7 +87,7 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
PortBindings[intPort] = [binding];
|
PortBindings[intPort] = [binding];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Send warning message? Internal port need to be specified.
|
Messages.send('Warning', 'Internal port must be specified for PortBindings');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
config.ExposedPorts = ExposedPorts;
|
config.ExposedPorts = ExposedPorts;
|
||||||
|
@ -102,8 +103,16 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
Container.create(config, function(d) {
|
Container.create(config, function(d) {
|
||||||
if (d.Id) {
|
if (d.Id) {
|
||||||
ctor.start({id: d.Id}, function(cd) {
|
ctor.start({id: d.Id}, function(cd) {
|
||||||
$('#create-modal').modal('hide');
|
if (cd.id) {
|
||||||
loc.path('/containers/' + d.Id + '/');
|
Messages.send('Container Started', d.Id);
|
||||||
|
$('#create-modal').modal('hide');
|
||||||
|
loc.path('/containers/' + d.Id + '/');
|
||||||
|
} else {
|
||||||
|
failedRequestHandler(cd, Messages);
|
||||||
|
ctor.remove({id: d.Id}, function() {
|
||||||
|
Messages.send('Container Removed', d.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
failedRequestHandler(e, Messages);
|
failedRequestHandler(e, Messages);
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe('startContainerController', function() {
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
||||||
'Id': id,
|
'id': id,
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ describe('startContainerController', function() {
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
||||||
'Id': id,
|
'id': id,
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ describe('startContainerController', function() {
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
||||||
'Id': id,
|
'id': id,
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ describe('startContainerController', function() {
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
$httpBackend.expectPOST('dockerapi/containers/' + id + '/start?').respond({
|
||||||
'Id': id,
|
'id': id,
|
||||||
'Warnings': null
|
'Warnings': null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -557,6 +557,8 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
|
|
||||||
if (config.Cmd && config.Cmd[0] === "[") {
|
if (config.Cmd && config.Cmd[0] === "[") {
|
||||||
config.Cmd = angular.fromJson(config.Cmd);
|
config.Cmd = angular.fromJson(config.Cmd);
|
||||||
|
} else if (config.Cmd) {
|
||||||
|
config.Cmd = config.Cmd.split(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Env = config.Env.map(function(envar) {return envar.name + '=' + envar.value;});
|
config.Env = config.Env.map(function(envar) {return envar.name + '=' + envar.value;});
|
||||||
|
@ -574,7 +576,6 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
|
|
||||||
var ExposedPorts = {};
|
var ExposedPorts = {};
|
||||||
var PortBindings = {};
|
var PortBindings = {};
|
||||||
// TODO: consider using compatibility library
|
|
||||||
config.HostConfig.PortBindings.forEach(function(portBinding) {
|
config.HostConfig.PortBindings.forEach(function(portBinding) {
|
||||||
var intPort = portBinding.intPort + "/tcp";
|
var intPort = portBinding.intPort + "/tcp";
|
||||||
var binding = {
|
var binding = {
|
||||||
|
@ -589,7 +590,7 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
PortBindings[intPort] = [binding];
|
PortBindings[intPort] = [binding];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Send warning message? Internal port need to be specified.
|
Messages.send('Warning', 'Internal port must be specified for PortBindings');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
config.ExposedPorts = ExposedPorts;
|
config.ExposedPorts = ExposedPorts;
|
||||||
|
@ -605,8 +606,16 @@ function($scope, $routeParams, $location, Container, Messages, containernameFilt
|
||||||
Container.create(config, function(d) {
|
Container.create(config, function(d) {
|
||||||
if (d.Id) {
|
if (d.Id) {
|
||||||
ctor.start({id: d.Id}, function(cd) {
|
ctor.start({id: d.Id}, function(cd) {
|
||||||
$('#create-modal').modal('hide');
|
if (cd.id) {
|
||||||
loc.path('/containers/' + d.Id + '/');
|
Messages.send('Container Started', d.Id);
|
||||||
|
$('#create-modal').modal('hide');
|
||||||
|
loc.path('/containers/' + d.Id + '/');
|
||||||
|
} else {
|
||||||
|
failedRequestHandler(cd, Messages);
|
||||||
|
ctor.remove({id: d.Id}, function() {
|
||||||
|
Messages.send('Container Removed', d.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
failedRequestHandler(e, Messages);
|
failedRequestHandler(e, Messages);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@ files = [
|
||||||
JASMINE,
|
JASMINE,
|
||||||
JASMINE_ADAPTER,
|
JASMINE_ADAPTER,
|
||||||
'assets/js/jquery-1.11.1.min.js',
|
'assets/js/jquery-1.11.1.min.js',
|
||||||
|
'assets/js/jquery.gritter.min.js',
|
||||||
'assets/js/bootstrap.min.js',
|
'assets/js/bootstrap.min.js',
|
||||||
'assets/js/angularjs/1.2.6/angular.min.js',
|
'assets/js/angularjs/1.2.6/angular.min.js',
|
||||||
'assets/js/angularjs/1.2.6/angular-route.min.js',
|
'assets/js/angularjs/1.2.6/angular-route.min.js',
|
||||||
|
|
Loading…
Reference in New Issue