mirror of
https://github.com/portainer/portainer.git
synced 2025-07-26 00:39:41 +02:00
Add spinner for loading times
This commit is contained in:
parent
0f8da44165
commit
86d7c4db5d
4 changed files with 381 additions and 18 deletions
|
@ -4,7 +4,6 @@ function MastheadController($scope) {
|
|||
}
|
||||
|
||||
function DashboardController($scope, Container) {
|
||||
|
||||
}
|
||||
|
||||
function StatusBarController($scope, Settings) {
|
||||
|
@ -20,7 +19,7 @@ function SideBarController($scope, Container, Settings) {
|
|||
$scope.endpoint = Settings.endpoint;
|
||||
|
||||
Container.query({all: 0}, function(d) {
|
||||
$scope.containers = d;
|
||||
$scope.containers = d;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,11 +45,11 @@ function SettingsController($scope, Auth, System, Docker, Settings) {
|
|||
}, function(e) {
|
||||
console.log(e);
|
||||
setFailedResponse($scope, e.data, '#response');
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Auth.get({}, function(d) {
|
||||
$scope.auth = d;
|
||||
$scope.auth = d;
|
||||
});
|
||||
|
||||
Docker.get({}, function(d) {
|
||||
|
@ -117,34 +116,36 @@ function ContainerController($scope, $routeParams, $location, Container) {
|
|||
|
||||
$scope.getChanges = function() {
|
||||
Container.changes({id: $routeParams.id}, function(d) {
|
||||
$scope.changes = d;
|
||||
$scope.changes = d;
|
||||
});
|
||||
};
|
||||
|
||||
Container.get({id: $routeParams.id}, function(d) {
|
||||
$scope.container = d;
|
||||
$scope.container = d;
|
||||
}, function(e) {
|
||||
console.log(e);
|
||||
setFailedResponse($scope, e.data, '#response');
|
||||
if (e.status === 404) {
|
||||
$('.detail').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.getChanges();
|
||||
}
|
||||
|
||||
// Controller for the list of containers
|
||||
function ContainersController($scope, Container, Settings) {
|
||||
function ContainersController($scope, Container, Settings, ViewSpinner) {
|
||||
$scope.displayAll = Settings.displayAll;
|
||||
$scope.predicate = '-Created';
|
||||
|
||||
var update = function(data) {
|
||||
ViewSpinner.spin();
|
||||
Container.query(data, function(d) {
|
||||
$scope.containers = d;
|
||||
});
|
||||
$scope.containers = d;
|
||||
ViewSpinner.stop();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.toggleGetAll = function() {
|
||||
Settings.displayAll = $scope.displayAll;
|
||||
var u = update;
|
||||
|
@ -156,11 +157,11 @@ function ContainersController($scope, Container, Settings) {
|
|||
u(data);
|
||||
};
|
||||
|
||||
update({all: $scope.displayAll ? 1 : 0});
|
||||
update({all: $scope.displayAll ? 1 : 0});
|
||||
}
|
||||
|
||||
// Controller for the list of images
|
||||
function ImagesController($scope, Image) {
|
||||
function ImagesController($scope, Image, ViewSpinner) {
|
||||
$scope.predicate = '-Created';
|
||||
$('#response').hide();
|
||||
$scope.alertClass = 'block';
|
||||
|
@ -169,11 +170,14 @@ function ImagesController($scope, Image) {
|
|||
$('#build-modal').modal('show');
|
||||
};
|
||||
|
||||
ViewSpinner.spin();
|
||||
Image.query({}, function(d) {
|
||||
$scope.images = d;
|
||||
ViewSpinner.stop();
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
setFailedResponse($scope, e.data, '#response');
|
||||
ViewSpinner.stop();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -285,7 +289,7 @@ function BuilderController($scope, Dockerfile) {
|
|||
|
||||
$scope.build = function() {
|
||||
Dockerfile.build(editor.getValue(), function(e) {
|
||||
console.log(e);
|
||||
console.log(e);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,14 +62,23 @@ angular.module('dockerui.services', ['ngResource'])
|
|||
displayAll: false,
|
||||
endpoint: DOCKER_ENDPOINT,
|
||||
version: DOCKER_API_VERSION,
|
||||
rawUrl: DOCKER_ENDPOINT + '/' + DOCKER_API_VERSION,
|
||||
rawUrl: DOCKER_ENDPOINT + DOCKER_PORT + '/' + DOCKER_API_VERSION,
|
||||
uiVersion: UI_VERSION,
|
||||
url: url
|
||||
};
|
||||
})
|
||||
.factory('ViewSpinner', function() {
|
||||
var spinner = new Spinner();
|
||||
var target = document.getElementById('view');
|
||||
|
||||
return {
|
||||
spin: function() { spinner.spin(target); },
|
||||
stop: function() { spinner.stop(); }
|
||||
};
|
||||
})
|
||||
.factory('Dockerfile', function(Settings) {
|
||||
var url = Settings.rawUrl + '/build';
|
||||
return {
|
||||
settings: Settings,
|
||||
build: function(file, callback) {
|
||||
var data = new FormData();
|
||||
var dockerfile = new Blob([file], { type: 'text/text' });
|
||||
|
@ -77,7 +86,7 @@ angular.module('dockerui.services', ['ngResource'])
|
|||
|
||||
var request = new XMLHttpRequest();
|
||||
request.onload = callback;
|
||||
request.open('POST', 'http://192.168.1.9:4243/v1.1/build');
|
||||
request.open('POST', url);
|
||||
request.send(data);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue