1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

Add images views and controllers

This commit is contained in:
Michael Crosby 2013-06-09 14:11:40 -09:00
parent 72cef567be
commit d4c556752f
6 changed files with 150 additions and 3 deletions

View file

@ -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();
}

View file

@ -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();
};
});

View file

@ -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'}},