1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 19:42:01 +02:00

Added ability to install from device screen. Still not synced to Upload panel.

This commit is contained in:
Gunther Brunner 2014-04-14 18:48:19 +09:00
parent 24afc6fbef
commit 3aa44f1a9c
3 changed files with 46 additions and 3 deletions

View file

@ -1,5 +1,4 @@
module.exports = function ($scope, gettext, $routeParams, $location, module.exports = function ($scope, gettext, $routeParams, $location, DeviceService, GroupService, ControlService) {
DeviceService, GroupService, ControlService) {
var sharedTabs = [ var sharedTabs = [
{ {
@ -56,6 +55,48 @@ module.exports = function ($scope, gettext, $routeParams, $location,
$scope.control = null $scope.control = null
$scope.installFileForced = function ($files) {
$scope.upload = {
progress: 0,
lastData: 'uploading'
}
var upload = $scope.control.uploadFile($files)
return upload.promise
.progressed(function (uploadResult) {
$scope.$apply(function () {
$scope.upload = uploadResult
})
})
.then(function (uploadResult) {
$scope.$apply(function () {
$scope.upload = uploadResult
})
if (uploadResult.success) {
return $scope.maybeInstallForced(uploadResult.body)
}
})
}
$scope.maybeInstallForced = function (options) {
var install = $scope.control.install(options)
return install.promise
.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
})
})
}
DeviceService.get($routeParams.serial, $scope) DeviceService.get($routeParams.serial, $scope)
.then(function (device) { .then(function (device) {
return GroupService.invite(device) return GroupService.invite(device)

View file

@ -1,5 +1,7 @@
device-screen canvas { device-screen canvas {
transition: width 80ms linear; transition: width 80ms linear;
-ms-transform: width 80ms linear;
-webkit-transform: width 80ms linear;
} }
device-screen { device-screen {

View file

@ -37,7 +37,7 @@
span.pull-right(ng-click='kickDevice(groupDevice); $event.stopPropagation()').kick-device span.pull-right(ng-click='kickDevice(groupDevice); $event.stopPropagation()').kick-device
i.fa.fa-times i.fa.fa-times
.as-row.fill-height(ng-file-drop='controll.install($files)') .as-row.fill-height(ng-file-drop='installFileForced($files)')
div(ng-controller='DeviceScreenCtrl').fill-height div(ng-controller='DeviceScreenCtrl').fill-height
device-screen(style='width: 100%; height: 100%; background: gray') device-screen(style='width: 100%; height: 100%; background: gray')