From 29df9cf226152fb289d6b0156bb08944e47e8fd3 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Mon, 28 Jul 2014 18:09:05 +0200 Subject: [PATCH] Added possibility to specify name at container creation --- js/controllers.js | 8 +++++--- js/services.js | 4 +++- partials/startcontainer.html | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/controllers.js b/js/controllers.js index 901360b68..3107c1007 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -214,13 +214,13 @@ function ContainerController($scope, $routeParams, $location, Container, Message // Controller for the list of containers function ContainersController($scope, Container, Settings, Messages, ViewSpinner) { $scope.predicate = '-Created'; - $scope.toggle = false; + $scope.toggle = false; $scope.displayAll = Settings.displayAll; var update = function(data) { ViewSpinner.spin(); Container.query(data, function(d) { - $scope.containers = d.map(function(item) { + $scope.containers = d.map(function(item) { return new ContainerViewModel(item); }); ViewSpinner.stop(); }); @@ -258,7 +258,7 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner }; $scope.toggleGetAll = function() { - Settings.displayAll = $scope.displayAll; + Settings.displayAll = $scope.displayAll; update({all: Settings.displayAll ? 1 : 0}); }; @@ -395,6 +395,7 @@ function ImageController($scope, $q, $routeParams, $location, Image, Container, function StartContainerController($scope, $routeParams, $location, Container, Messages) { $scope.template = 'partials/startcontainer.html'; $scope.config = { + name: '', memory: 0, memorySwap: 0, env: '', @@ -415,6 +416,7 @@ function StartContainerController($scope, $routeParams, $location, Container, Me Container.create({ Image: id, + name: $scope.config.name, Memory: $scope.config.memory, MemorySwap: $scope.config.memorySwap, Cmd: cmds, diff --git a/js/services.js b/js/services.js index 9a6a00268..017d9668c 100644 --- a/js/services.js +++ b/js/services.js @@ -4,7 +4,9 @@ angular.module('dockerui.services', ['ngResource']) .factory('Container', function($resource, Settings) { // Resource for interacting with the docker containers // http://docs.docker.io/en/latest/api/docker_remote_api.html#containers - return $resource(Settings.url + '/containers/:id/:action', {}, { + return $resource(Settings.url + '/containers/:id/:action', { + name: '@name' + }, { query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true}, get :{method: 'GET', params: { action:'json'}}, start: {method: 'POST', params: {id: '@id', action: 'start'}}, diff --git a/partials/startcontainer.html b/partials/startcontainer.html index 24081af8f..10b1e8639 100644 --- a/partials/startcontainer.html +++ b/partials/startcontainer.html @@ -11,6 +11,10 @@ Input commands as an array + + + +