mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
Added VolumesFrom to container start.
This commit is contained in:
parent
4d22a04484
commit
c8213bbf33
3 changed files with 142 additions and 23 deletions
|
@ -1,7 +1,14 @@
|
|||
angular.module('startContainer', [])
|
||||
.controller('StartContainerController', ['$scope', '$routeParams', '$location', 'Container', 'Messages',
|
||||
function($scope, $routeParams, $location, Container, Messages) {
|
||||
.controller('StartContainerController', ['$scope', '$routeParams', '$location', 'Container', 'Messages', 'containernameFilter',
|
||||
function($scope, $routeParams, $location, Container, Messages, containernameFilter) {
|
||||
$scope.template = 'app/components/startContainer/startcontainer.html';
|
||||
|
||||
Container.query({all: 1}, function(d) {
|
||||
$scope.containerNames = d.map(function(container){
|
||||
return containernameFilter(container);
|
||||
});
|
||||
});
|
||||
|
||||
$scope.config = {
|
||||
name: '',
|
||||
memory: 0,
|
||||
|
@ -9,7 +16,7 @@ function($scope, $routeParams, $location, Container, Messages) {
|
|||
cpuShares: 1024,
|
||||
env: [],
|
||||
commands: '',
|
||||
volumesFrom: '',
|
||||
volumesFrom: [],
|
||||
portBindings: []
|
||||
};
|
||||
$scope.commandPlaceholder = '["/bin/echo", "Hello world"]';
|
||||
|
@ -28,6 +35,10 @@ function($scope, $routeParams, $location, Container, Messages) {
|
|||
var loc = $location;
|
||||
var s = $scope;
|
||||
|
||||
var volumesFrom = $scope.config.volumesFrom.map(function(volume) {
|
||||
return volume.name;
|
||||
});
|
||||
|
||||
var env = $scope.config.env.map(function(envar) {
|
||||
return envar.name + '=' + envar.value;
|
||||
});
|
||||
|
@ -60,7 +71,7 @@ function($scope, $routeParams, $location, Container, Messages) {
|
|||
MemorySwap: $scope.config.memorySwap,
|
||||
CpuShares: $scope.config.cpuShares,
|
||||
Cmd: cmds,
|
||||
VolumesFrom: $scope.config.volumesFrom,
|
||||
VolumesFrom: volumesFrom,
|
||||
Env: env,
|
||||
ExposedPorts: exposedPorts,
|
||||
HostConfig: {
|
||||
|
@ -104,4 +115,13 @@ function($scope, $routeParams, $location, Container, Messages) {
|
|||
var idx = $scope.config.env.indexOf(envar);
|
||||
$scope.config.env.splice(idx, 1);
|
||||
};
|
||||
|
||||
$scope.addVolume = function() {
|
||||
$scope.config.volumesFrom.push({name: ''});
|
||||
};
|
||||
|
||||
$scope.removeVolume = function(volume) {
|
||||
var idx = $scope.config.volumesFrom.indexOf(volume);
|
||||
$scope.config.volumesFrom.splice(idx, 1);
|
||||
};
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue