mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 05:15:25 +02:00
This commit is contained in:
parent
d2702d6d7b
commit
5bca9560c9
16 changed files with 278 additions and 10 deletions
31
app/docker/views/images/import/importImageController.js
Normal file
31
app/docker/views/images/import/importImageController.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('ImportImageController', ['$scope', '$state', 'ImageService', 'Notifications', 'HttpRequestHelper',
|
||||
function ($scope, $state, ImageService, Notifications, HttpRequestHelper) {
|
||||
|
||||
$scope.state = {
|
||||
actionInProgress: false
|
||||
};
|
||||
|
||||
$scope.formValues = {
|
||||
UploadFile: null,
|
||||
NodeName: null
|
||||
};
|
||||
|
||||
$scope.uploadImage = function() {
|
||||
$scope.state.actionInProgress = true;
|
||||
|
||||
var nodeName = $scope.formValues.NodeName;
|
||||
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);
|
||||
var file = $scope.formValues.UploadFile;
|
||||
ImageService.uploadImage(file)
|
||||
.then(function success() {
|
||||
Notifications.success('Images successfully uploaded');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err.message, 'Unable to upload image');
|
||||
})
|
||||
.finally(function final() {
|
||||
$scope.state.actionInProgress = false;
|
||||
});
|
||||
};
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue