From 3aa44f1a9ccf96b67e8c84446e40023d1ce3fde0 Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Mon, 14 Apr 2014 18:48:19 +0900 Subject: [PATCH] Added ability to install from device screen. Still not synced to Upload panel. --- .../control-panes/control-panes-controller.js | 45 ++++++++++++++++++- .../device-control/device-control.css | 2 + .../device-control/device-control.jade | 2 +- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/res/app/control-panes/control-panes-controller.js b/res/app/control-panes/control-panes-controller.js index ad91776f..7be6d89e 100644 --- a/res/app/control-panes/control-panes-controller.js +++ b/res/app/control-panes/control-panes-controller.js @@ -1,5 +1,4 @@ -module.exports = function ($scope, gettext, $routeParams, $location, - DeviceService, GroupService, ControlService) { +module.exports = function ($scope, gettext, $routeParams, $location, DeviceService, GroupService, ControlService) { var sharedTabs = [ { @@ -56,6 +55,48 @@ module.exports = function ($scope, gettext, $routeParams, $location, $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) .then(function (device) { return GroupService.invite(device) diff --git a/res/app/control-panes/device-control/device-control.css b/res/app/control-panes/device-control/device-control.css index 2a51d2f9..8c836b42 100644 --- a/res/app/control-panes/device-control/device-control.css +++ b/res/app/control-panes/device-control/device-control.css @@ -1,5 +1,7 @@ device-screen canvas { transition: width 80ms linear; + -ms-transform: width 80ms linear; + -webkit-transform: width 80ms linear; } device-screen { diff --git a/res/app/control-panes/device-control/device-control.jade b/res/app/control-panes/device-control/device-control.jade index 20cb05b7..314884aa 100644 --- a/res/app/control-panes/device-control/device-control.jade +++ b/res/app/control-panes/device-control/device-control.jade @@ -37,7 +37,7 @@ span.pull-right(ng-click='kickDevice(groupDevice); $event.stopPropagation()').kick-device 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 device-screen(style='width: 100%; height: 100%; background: gray')