mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
merge fix-viewspinner
This commit is contained in:
commit
fd6645d068
19 changed files with 112 additions and 103 deletions
|
@ -33,6 +33,7 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-default btn-sm" ng-disabled="!config.Image" ng-click="pullImage()">Pull</button>
|
||||
<i id="pullImageSpinner" class="fa fa-cog fa-spin" style="margin-left: 5px; display: none;"></i>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -45,6 +46,9 @@
|
|||
<div class="col-lg-12 col-md-12 col-xs-12">
|
||||
<rd-widget>
|
||||
<rd-widget-header icon="fa-clone" title="Images">
|
||||
<div class="pull-right">
|
||||
<i id="loadImagesSpinner" class="fa fa-cog fa-2x fa-spin" style="margin-top: 5px;"></i>
|
||||
</div>
|
||||
</rd-widget-header>
|
||||
<rd-widget-taskbar classes="col-lg-12">
|
||||
<div class="pull-left">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
angular.module('images', [])
|
||||
.controller('ImagesController', ['$scope', '$state', 'Image', 'ViewSpinner', 'Messages',
|
||||
function ($scope, $state, Image, ViewSpinner, Messages) {
|
||||
.controller('ImagesController', ['$scope', '$state', 'Image', 'Messages',
|
||||
function ($scope, $state, Image, Messages) {
|
||||
$scope.state = {};
|
||||
$scope.sortType = 'RepoTags';
|
||||
$scope.sortReverse = true;
|
||||
|
@ -45,32 +45,32 @@ function ($scope, $state, Image, ViewSpinner, Messages) {
|
|||
}
|
||||
|
||||
$scope.pullImage = function() {
|
||||
ViewSpinner.spin();
|
||||
$('#pullImageSpinner').show();
|
||||
var image = _.toLower($scope.config.Image);
|
||||
var imageConfig = createImageConfig(image);
|
||||
Image.create(imageConfig, function (data) {
|
||||
var err = data.length > 0 && data[data.length - 1].hasOwnProperty('error');
|
||||
if (err) {
|
||||
var detail = data[data.length - 1];
|
||||
ViewSpinner.stop();
|
||||
$('#pullImageSpinner').hide();
|
||||
Messages.error('Error', detail.error);
|
||||
} else {
|
||||
ViewSpinner.stop();
|
||||
$('#pullImageSpinner').hide();
|
||||
$state.go('images', {}, {reload: true});
|
||||
}
|
||||
}, function (e) {
|
||||
ViewSpinner.stop();
|
||||
$('#pullImageSpinner').hide();
|
||||
Messages.error('Error', 'Unable to pull image ' + image);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeAction = function () {
|
||||
ViewSpinner.spin();
|
||||
$('#loadImagesSpinner').show();
|
||||
var counter = 0;
|
||||
var complete = function () {
|
||||
counter = counter - 1;
|
||||
if (counter === 0) {
|
||||
ViewSpinner.stop();
|
||||
$('#loadImagesSpinner').hide();
|
||||
}
|
||||
};
|
||||
angular.forEach($scope.images, function (i) {
|
||||
|
@ -85,6 +85,7 @@ function ($scope, $state, Image, ViewSpinner, Messages) {
|
|||
complete();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
$('#loadImagesSpinner').hide();
|
||||
complete();
|
||||
});
|
||||
}
|
||||
|
@ -92,15 +93,14 @@ function ($scope, $state, Image, ViewSpinner, Messages) {
|
|||
};
|
||||
|
||||
function fetchImages() {
|
||||
ViewSpinner.spin();
|
||||
Image.query({}, function (d) {
|
||||
$scope.images = d.map(function (item) {
|
||||
return new ImageViewModel(item);
|
||||
});
|
||||
ViewSpinner.stop();
|
||||
$('#loadImagesSpinner').hide();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
ViewSpinner.stop();
|
||||
$('#loadImagesSpinner').hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue