1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Merge branch 'develop' of ghe.amb.ca.local:stf/stf into develop

This commit is contained in:
Gunther Brunner 2014-04-04 17:34:43 +09:00
commit 5ec5ae12b5
9 changed files with 288 additions and 88 deletions

View file

@ -1,34 +1,48 @@
module.exports = function UploadCtrl($scope, $rootScope, SettingsService, gettext) {
$scope.upload = null
$scope.installation = null
$scope.clear = function () {
$scope.upload = null
$scope.installation = null
}
$rootScope.install = function ($files) {
$scope.installation = {
$scope.upload = {
progress: 0,
lastData: 'uploading'
}
return $rootScope.control.install($files)
.then(function (tx) {
var manifest = tx.manifest
return tx.promise
.progressed(function (result) {
$scope.$apply(function () {
result.manifest = manifest
$scope.installation = result
var upload = $rootScope.control.upload($files)
$scope.installation = null
return upload.promise
.progressed(function(uploadResult) {
$scope.$apply(function() {
$scope.upload = uploadResult
})
})
.then(function(uploadResult) {
$scope.$apply(function() {
$scope.upload = uploadResult
})
if (uploadResult.success) {
var install = $rootScope.control.install(uploadResult.body)
return install.promise
.progressed(function(installResult) {
$scope.$apply(function() {
installResult.manifest = uploadResult.body.manifest
$scope.installation = installResult
})
})
})
.then(function (result) {
$scope.$apply(function () {
result.manifest = manifest
$scope.treeData = manifest
$scope.installation = result
.then(function(installResult) {
$scope.$apply(function() {
installResult.manifest = uploadResult.body.manifest
$scope.treeData = installResult.manifest
$scope.installation = installResult
})
})
})
}
})
}