mirror of https://github.com/portainer/portainer
feat(image-details): add the ability to pull/update a tag (#421)
parent
b6627098c2
commit
c2e63070e6
|
@ -11,24 +11,36 @@
|
|||
<div class="col-lg-12 col-md-12 col-xs-12">
|
||||
<rd-widget>
|
||||
<rd-widget-header icon="fa fa-tags" title="Image tags"></rd-widget-header>
|
||||
<rd-widget-body classes="no-padding">
|
||||
<div style="margin: 5px 10px;">
|
||||
<span ng-repeat="tag in RepoTags" class="label label-primary image-tag space-right">
|
||||
<a data-toggle="tooltip" class="interactive" title="Push to registry" ng-click="pushImage(tag)">
|
||||
<i class="fa fa-upload white-icon" aria-hidden="true"></i>
|
||||
</a>
|
||||
{{ tag }}
|
||||
<a data-toggle="tooltip" class="interactive" title="Remove tag" ng-click="removeImage(tag)">
|
||||
<i class="fa fa-trash-o white-icon" aria-hidden="true"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<div style="margin: 5px 10px;">
|
||||
<span class="small text-muted">
|
||||
Note: you can click on the upload icon to push an image
|
||||
and on the trash icon to delete a tag
|
||||
</span>
|
||||
</div>
|
||||
<rd-widget-body>
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="pull-left" ng-repeat="tag in RepoTags" style="display:table">
|
||||
<div class="input-group col-md-1" style="padding:0 15px">
|
||||
<span class="input-group-addon">{{ tag }}</span>
|
||||
<span class="input-group-btn">
|
||||
<a data-toggle="tooltip" class="btn btn-primary interactive" title="Push to registry" ng-click="pushImage(tag)">
|
||||
<span class="fa fa-upload white-icon" aria-hidden="true"></span>
|
||||
</a>
|
||||
<a data-toggle="tooltip" class="btn btn-primary interactive" title="Pull from registry" ng-click="pullImage(tag)">
|
||||
<span class="fa fa-download white-icon" aria-hidden="true"></span>
|
||||
</a>
|
||||
<a data-toggle="tooltip" class="btn btn-primary interactive" title="Remove tag" ng-click="removeImage(tag)">
|
||||
<span class="fa fa-trash-o white-icon" aria-hidden="true"></span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<span class="small text-muted">
|
||||
Note: you can click on the upload icon to push or on the download icon to pull an image and on the trash icon to delete a tag
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</rd-widget-body>
|
||||
</rd-widget>
|
||||
</div>
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue