mirror of https://github.com/portainer/portainer
24 lines
507 B
JavaScript
24 lines
507 B
JavaScript
angular.module('portainer.agent').controller('FileUploaderController', [
|
|
'$q',
|
|
function FileUploaderController($q) {
|
|
var ctrl = this;
|
|
|
|
ctrl.state = {
|
|
uploadInProgress: false
|
|
};
|
|
|
|
ctrl.onFileSelected = onFileSelected;
|
|
|
|
function onFileSelected(file) {
|
|
if (!file) {
|
|
return;
|
|
}
|
|
|
|
ctrl.state.uploadInProgress = true;
|
|
$q.when(ctrl.uploadFile(file)).finally(function toggleProgress() {
|
|
ctrl.state.uploadInProgress = false;
|
|
});
|
|
}
|
|
}
|
|
]);
|