1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(image-details): simple image history (#425)

This commit is contained in:
Gábor Kovács 2017-07-08 08:59:32 +02:00 committed by Anthony Lapenna
parent 6d6f4f092d
commit b6b579d55d
6 changed files with 99 additions and 8 deletions

View file

@ -167,3 +167,42 @@
</rd-widget>
</div>
</div>
<div class="row" ng-if="history.length > 0">
<div class="col-lg-12 col-md-12 col-xs-12">
<rd-widget>
<rd-widget-header icon="fa-clone" title="Image layers"></rd-widget-header>
<rd-widget-body classes="no-padding">
<table id="image-layers" class="table">
<thead>
<tr>
<td>Size</td>
<td>Layer</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="layer in history">
<td style="white-space:nowrap;">{{layer.Size|humansize}}</td>
<td class="expand">
<div ng-if="layer.CreatedBy.length > 100">
<span id="layer-command-{{$index}}-full" style="display: none">
{{layer.CreatedBy|createdby}}
</span>
<span id="layer-command-{{$index}}-short">
{{layer.CreatedBy|createdby|limitTo:100}}{{layer.CreatedBy.length > 100 ? '...' : ''}}
</span>
</div>
<div ng-if="layer.CreatedBy.length <= 100">
<span id="layer-command-{{$index}}-full">
{{layer.CreatedBy|createdby}}
</span>
</div>
<div ng-if="layer.CreatedBy.length > 100"><a id="layer-command-expander{{$index}}" class="btn" ng-click='toggleLayerCommand($index)'><span class="glyphicon glyphicon-plus-sign"></span></a></div>
</td>
</tr>
</tbody>
</table>
</rd-widget-body>
</rd-widget>
</div>
</div>

View file

@ -6,6 +6,12 @@ function ($scope, $stateParams, $state, $timeout, ImageService, RegistryService,
Registry: ''
};
$scope.toggleLayerCommand = function(layerId) {
$('#layer-command-expander'+layerId+' span').toggleClass('glyphicon-plus-sign glyphicon-minus-sign');
$('#layer-command-'+layerId+'-short').toggle();
$('#layer-command-'+layerId+'-full').toggle();
};
$scope.tagImage = function() {
$('#loadingViewSpinner').show();
var image = $scope.formValues.Image;
@ -108,6 +114,18 @@ function ($scope, $stateParams, $state, $timeout, ImageService, RegistryService,
.finally(function final() {
$('#loadingViewSpinner').hide();
});
$('#loadingViewSpinner').show();
ImageService.history($stateParams.id)
.then(function success(data) {
$scope.history = data;
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to retrieve image history');
})
.finally(function final() {
$('#loadingViewSpinner').hide();
});
}
retrieveImageDetails();