mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Remove installation code from control-panes-controller until we find a way to reuse InstallController there or find some other way to make them work together.
This commit is contained in:
parent
cc403ee553
commit
484f868094
1 changed files with 0 additions and 79 deletions
|
@ -77,85 +77,6 @@ module.exports =
|
|||
$scope.device = null
|
||||
$scope.control = null
|
||||
|
||||
// @TODO Find a way to reuse this in the upload controller (or the other
|
||||
// way around)
|
||||
$scope.installFileForced = function ($files) {
|
||||
$scope.$apply(function () {
|
||||
$scope.upload = {
|
||||
progress: 0, lastData: 'uploading'
|
||||
}
|
||||
})
|
||||
|
||||
return StorageService.storeFile('apk', $files, {
|
||||
filter: function (file) {
|
||||
return /\.apk$/i.test(file.name)
|
||||
}
|
||||
})
|
||||
.progressed(function (e) {
|
||||
if (e.lengthComputable) {
|
||||
$scope.$apply(function () {
|
||||
$scope.upload = {
|
||||
progress: e.loaded / e.total * 100, lastData: 'uploading'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
$scope.$apply(function () {
|
||||
$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.installForced({
|
||||
href: href, launch: true, manifest: res.data.manifest
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(function (err) {
|
||||
$scope.$apply(function () {
|
||||
if (err.code === 'no_input_files') {
|
||||
$scope.upload = null
|
||||
}
|
||||
else {
|
||||
console.log('Upload error', err)
|
||||
$scope.upload = {
|
||||
progress: 100,
|
||||
lastData: 'fail',
|
||||
settled: true,
|
||||
error: err.message
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
$scope.installForced = function (options) {
|
||||
return $scope.control.install(options)
|
||||
.progressed(function (installResult) {
|
||||
$scope.$apply(function () {
|
||||
installResult.manifest = options.manifest
|
||||
$scope.installation = installResult
|
||||
})
|
||||
})
|
||||
.then(function (installResult) {
|
||||
$scope.$apply(function () {
|
||||
installResult.manifest = options.manifest
|
||||
$scope.treeData = installResult.manifest
|
||||
$scope.installation = installResult
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Move this out to Ctrl.resolve
|
||||
// http://blog.brunoscopelliti.com/show-route-only-after-all-promises-are-resolved
|
||||
// http://odetocode.com/blogs/scott/archive/2014/05/20/using-resolve-in-angularjs-routes.aspx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue