Show progress for URL installation. Temporarily break upload installation.

This commit is contained in:
Simo Kinnunen
2014-04-04 17:27:19 +09:00
parent 1d2afa65b4
commit 44378e625f
9 changed files with 288 additions and 88 deletions

View File

@@ -109,7 +109,29 @@ module.exports = function ControlServiceFactory(
return tx
}
function install(options) {
this.upload = function(files) {
var tx = TransactionService.create({
id: 'storage'
})
if (typeof files === 'string') {
socket.emit('storage.upload', channel, tx.channel, {
url: files
})
return tx
}
else {
return $upload.upload({
url: '/api/v1/resources'
, method: 'POST'
, file: files[0]
})
.then(function(response) {
return install(response.data)
})
}
}
this.install = function(options) {
var app = options.manifest.application
var tx = TransactionService.create(target)
var params = {
@@ -129,31 +151,6 @@ module.exports = function ControlServiceFactory(
return tx
}
this.install = function(files) {
if (typeof files === 'string') {
return $http({
url: '/api/v1/resources'
, method: 'POST'
, data: {
url: files
}
})
.then(function(response) {
return install(response.data)
})
}
else {
return $upload.upload({
url: '/api/v1/resources'
, method: 'POST'
, file: files[0]
})
.then(function(response) {
return install(response.data)
})
}
}
this.uninstall = function(pkg) {
var tx = TransactionService.create(target)
socket.emit('device.uninstall', channel, tx.channel, {