mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:33:24 +02:00
Merge branch 'feature/screenshot' into develop
Conflicts: res/app/control-panes/dashboard/upload/upload.jade
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
module.exports = function UploadCtrl($scope, SettingsService, gettext) {
|
||||
|
||||
module.exports = function UploadCtrl(
|
||||
$scope
|
||||
, $http
|
||||
, SettingsService
|
||||
, StorageService
|
||||
) {
|
||||
$scope.upload = null
|
||||
$scope.installation = null
|
||||
$scope.installEnabled = true
|
||||
@@ -35,23 +39,49 @@ module.exports = function UploadCtrl($scope, SettingsService, gettext) {
|
||||
|
||||
$scope.installFile = function ($files) {
|
||||
$scope.upload = {
|
||||
progress: 0,
|
||||
lastData: 'uploading'
|
||||
progress: 0
|
||||
, lastData: 'uploading'
|
||||
}
|
||||
|
||||
$scope.installation = null
|
||||
return $scope.control.uploadFile($files)
|
||||
.progressed(function (uploadResult) {
|
||||
$scope.$apply(function () {
|
||||
$scope.upload = uploadResult
|
||||
})
|
||||
return StorageService.storeFile('apk', $files)
|
||||
.progressed(function(e) {
|
||||
if (e.lengthComputable) {
|
||||
$scope.upload = {
|
||||
progress: e.loaded / e.total * 100
|
||||
, lastData: 'uploading'
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function (uploadResult) {
|
||||
$scope.$apply(function () {
|
||||
$scope.upload = uploadResult
|
||||
})
|
||||
if (uploadResult.success) {
|
||||
return $scope.maybeInstall(uploadResult.body)
|
||||
.then(function(res) {
|
||||
$scope.upload = {
|
||||
progress: 100
|
||||
, lastData: 'processing'
|
||||
}
|
||||
|
||||
var href = res.data.resources.file0.href
|
||||
return $http.get(href + '/manifest')
|
||||
.then(function(res) {
|
||||
$scope.upload = {
|
||||
progress: 100
|
||||
, lastData: 'success'
|
||||
, settled: true
|
||||
}
|
||||
|
||||
if (res.data.success) {
|
||||
return $scope.maybeInstall({
|
||||
href: href
|
||||
, launch: $scope.launchEnabled
|
||||
, manifest: res.data.manifest
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log('Upload error', err)
|
||||
$scope.upload = {
|
||||
progress: 100
|
||||
, lastData: 'fail'
|
||||
, settled: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
i.fa.fa-upload
|
||||
span(translate) Upload
|
||||
clear-button(ng-click='clear()', ng-disabled='!installation && !upload').btn-xs
|
||||
//label.checkbox-inline.pull-right
|
||||
input(type='checkbox', ng-model='launchEnabled', ng-disabled='true')
|
||||
span(translate) Launch
|
||||
label.checkbox-inline.pull-right
|
||||
input(type='checkbox', ng-model='launchEnabled')
|
||||
span Launch
|
||||
label.checkbox-inline.pull-right
|
||||
input(type='checkbox', ng-model='installEnabled')
|
||||
span(translate) Install
|
||||
@@ -65,8 +65,6 @@
|
||||
span(translate) Uploading...
|
||||
strong(ng-switch-when='processing')
|
||||
span(translate) Processing...
|
||||
strong(ng-switch-when='storing')
|
||||
span(translate) Storing...
|
||||
strong(ng-switch-when='fail')
|
||||
span(translate) Upload failed
|
||||
strong(ng-switch-when='success')
|
||||
|
||||
Reference in New Issue
Block a user