diff --git a/js/controllers.js b/js/controllers.js index 2deaf25c8..e9e8100ef 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -49,16 +49,22 @@ function SettingsController() { } function ContainerController($scope, $routeParams, Container) { + $('#response').hide(); $scope.start = function(){ Container.start({id: $routeParams.id}, function(d) { $scope.response = d; + $('#response').show(); + setTimeout($('#response').hide, 5000); }); }; $scope.stop = function() { + Container.stop({id: $routeParams.id}, function(d) { $scope.response = d; + $('#response').show(); + setTimeout($('#response').hide, 5000); }); }; @@ -85,11 +91,26 @@ function ContainerController($scope, $routeParams, Container) { $scope.getChanges(); } -function ContainersController($scope, Container) { - Container.query({}, function(d) { - $scope.containers = d; - }); -} +function ContainersController($scope, Container, Settings) { + $scope.displayAll = Settings.displayAll; + $scope.predicate = '-Created'; + var update = function(data) { + Container.query(data, function(d) { + $scope.containers = d; + }); + }; + + $scope.toggleGetAll = function() { + Settings.displayAll = $scope.displayAll; + var u = update; + var data = {all: 0}; + if ($scope.displayAll) { + data.all = 1; + } + u(data); + }; + update({all: $scope.displayAll ? 1 : 0}); + } function ImagesController($scope, Image) { @@ -101,7 +122,7 @@ function ImagesController($scope, Image) { function ImageController($scope, $routeParams, Image) { $scope.history = []; - $scope.tag = {tag: '', repo: '', force: false}; + $scope.tag = {repo: '', force: false}; $scope.remove = function() { if (confirm("Are you sure you want to delete this image?")) { Image.remove({id: $routeParams.id}, function(d) { @@ -118,7 +139,7 @@ function ImageController($scope, $routeParams, Image) { $scope.updateTag = function() { var tag = $scope.tag; - Image.tag({id: $routeParams.id, tag: tag.tag, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) { + Image.tag({id: $routeParams.id, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) { $scope.response = d; }); }; diff --git a/js/filters.js b/js/filters.js index 623c45093..b271ff3fb 100644 --- a/js/filters.js +++ b/js/filters.js @@ -21,6 +21,8 @@ angular.module('dockerui.filters', []) return function(text) { if (text === 'Ghost') { return 'important'; + } else if (text.indexOf('Exit') != -1 && text !== 'Exit 0') { + return 'warning'; } return 'success'; }; diff --git a/js/services.js b/js/services.js index edc6b2337..4a86342b4 100644 --- a/js/services.js +++ b/js/services.js @@ -7,13 +7,13 @@ angular.module('dockerui.services', ['ngResource']) return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, { query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true}, get :{method: 'GET', params: { action:'json'}}, - start: {method: 'POST', params: { action: 'start'}}, - stop: {method: 'POST', params: {t: 5, action: 'stop'}}, - restart: {method: 'POST', params: {t: 5, action: 'restart' }}, - kill :{method: 'POST', params: {action:'kill'}}, + start: {method: 'POST', params: {id: '@id', action: 'start'}}, + stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}}, + restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart' }}, + kill :{method: 'POST', params: {id: '@id', action:'kill'}}, changes :{method: 'GET', params: {action:'changes'}, isArray: true}, create :{method: 'POST', params: {action:'create'}}, - remove :{method: 'DELETE', params: {v:0}} + remove :{method: 'DELETE', params: {id: '@id', v:0}} }); }) .factory('Image', function($resource, DOCKER_ENDPOINT) { @@ -25,9 +25,14 @@ angular.module('dockerui.services', ['ngResource']) search :{method: 'GET', params: { action:'search'}}, history :{method: 'GET', params: { action:'history'}, isArray: true}, create :{method: 'POST', params: {action:'create'}}, - insert :{method: 'POST', params: {action:'insert'}}, - push :{method: 'POST', params: {action:'push'}}, - tag :{method: 'POST', params: {action:'tag'}}, - delete :{method: 'DELETE'} + insert :{method: 'POST', params: {id: '@id', action:'insert'}}, + push :{method: 'POST', params: {id: '@id', action:'push'}}, + tag :{method: 'POST', params: {id: '@id', action:'tag'}}, + delete :{id: '@id', method: 'DELETE'} }); + }) + .factory('Settings', function() { + return { + displayAll: false + }; }); diff --git a/partials/container.html b/partials/container.html index 1b858c163..6a44f02c1 100644 --- a/partials/container.html +++ b/partials/container.html @@ -1,4 +1,8 @@
{{ container.Id|truncate:10}} | -{{ container.Image }} | -{{ container.Command }} | -{{ container.Created }} | +{{ container.Image }} | +{{ container.Command|truncate:40 }} | +{{ container.Created|getdate }} | {{ container.Status }} |