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:
parent
72cef567be
commit
d4c556752f
6 changed files with 150 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
});
|
||||
|
|
|
@ -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'}},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue