diff --git a/js/controllers.js b/js/controllers.js index 6df90d70b..2deaf25c8 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -90,3 +90,42 @@ function ContainersController($scope, Container) { $scope.containers = d; }); } + +function ImagesController($scope, Image) { + + $scope.predicate = '-Created'; + Image.query({}, function(d) { + $scope.images = d; + }); +} + +function ImageController($scope, $routeParams, Image) { + $scope.history = []; + $scope.tag = {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) { + $scope.response = d; + }); + } + }; + + $scope.getHistory = function() { + Image.history({id: $routeParams.id}, function(d) { + $scope.history = d; + }); + }; + + $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) { + $scope.response = d; + }); + }; + + Image.get({id: $routeParams.id}, function(d) { + $scope.image = d; + }); + + $scope.getHistory(); +} diff --git a/js/filters.js b/js/filters.js index c068dd12a..623c45093 100644 --- a/js/filters.js +++ b/js/filters.js @@ -24,4 +24,11 @@ angular.module('dockerui.filters', []) } return 'success'; }; + }) + .filter('getdate', function() { + return function(data) { + //Multiply by 1000 for the unix format + var date = new Date(data * 1000); + return date.toDateString(); + }; }); diff --git a/js/services.js b/js/services.js index daab27383..edc6b2337 100644 --- a/js/services.js +++ b/js/services.js @@ -19,11 +19,11 @@ angular.module('dockerui.services', ['ngResource']) .factory('Image', function($resource, DOCKER_ENDPOINT) { // Resource for docker images // http://docs.docker.io/en/latest/api/docker_remote_api.html#images - return $resource(DOCKER_ENDPOINT + '/images/:name/:action', {}, { + return $resource(DOCKER_ENDPOINT + '/images/:id/:action', {}, { query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true}, get :{method: 'GET', params: { action:'json'}}, search :{method: 'GET', params: { action:'search'}}, - history :{method: 'GET', params: { action:'history'}}, + 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'}}, diff --git a/partials/container.html b/partials/container.html index b72d3789e..1b858c163 100644 --- a/partials/container.html +++ b/partials/container.html @@ -1,4 +1,3 @@ -

Container: {{ container.Id }}

diff --git a/partials/image.html b/partials/image.html new file mode 100644 index 000000000..701439bcf --- /dev/null +++ b/partials/image.html @@ -0,0 +1,81 @@ +
+

Image: {{ image.id }}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Created:{{ image.created }}
Parent:{{ image.parent }}
Container:{{ image.container }}
Hostname:{{ image.container_config.Hostname }}
User:{{ image.container_config.User }}
Cmd:{{ image.container_config.Cmd }}
Volumes:{{ image.container_config.Volumes }}
Volumes from:{{ image.container_config.VolumesFrom }}
+ +
+
+ History: +
+
+ +
+
+ +
+
    +
  • + {{ change.Id }}: Created: {{ change.Created|getdate }} Created by: {{ change.CreatedBy }} +
  • +
+
+ +
+ +
+
+
+ Add Tag + + + + + + +
+
+
+
+ +
+ +
+
diff --git a/partials/images.html b/partials/images.html new file mode 100644 index 000000000..0840f3938 --- /dev/null +++ b/partials/images.html @@ -0,0 +1,21 @@ + +

Images:

+ + + + + + + + + + + + + + + + + + +
IdTagRepositoryCreated
{{ image.Id|truncate:10}}{{ image.Tag }}{{ image.Repository }}{{ image.Created|getdate }}