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

feat(image-details): add the ability to pull/update a tag (#421)

This commit is contained in:
Gábor Kovács 2017-03-20 11:45:04 +01:00 committed by Anthony Lapenna
parent b6627098c2
commit c2e63070e6
2 changed files with 54 additions and 20 deletions

View file

@ -1,6 +1,11 @@
angular.module('image', [])
.controller('ImageController', ['$scope', '$stateParams', '$state', 'Image', 'ImageHelper', 'Messages',
function ($scope, $stateParams, $state, Image, ImageHelper, Messages) {
.filter('onlylabel', function(){
return function(tag){
return tag.substr(tag.indexOf(":")+1);
};
})
.controller('ImageController', ['$scope', '$stateParams', '$state', 'Image', 'ImageService', 'ImageHelper', 'Messages',
function ($scope, $stateParams, $state, Image, ImageService, ImageHelper, Messages) {
$scope.RepoTags = [];
$scope.config = {
Image: '',
@ -49,6 +54,23 @@ function ($scope, $stateParams, $state, Image, ImageHelper, Messages) {
});
};
$scope.pullImage = function(tag) {
var items = tag.split(":");
var image = items[0];
tag = items[1];
$('#loadingViewSpinner').show();
ImageService.pullImage({fromImage: image, tag: tag})
.then(function success(data) {
Messages.send('Image successfully pulled');
})
.catch(function error(error){
Messages.error("Failure", error, "Unable to pull image");
})
.finally(function final() {
$('#loadingViewSpinner').hide();
});
};
$scope.removeImage = function (id) {
$('#loadingViewSpinner').show();
Image.remove({id: id}, function (d) {