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

- Controlling devices from control-panes.

This commit is contained in:
Gunther Brunner 2014-03-31 16:13:12 +09:00
parent e173a4f648
commit f8a4fee2bb
12 changed files with 116 additions and 72 deletions

View file

@ -11,7 +11,6 @@ angular.module('app', [
'angularFileUpload', 'angularFileUpload',
require('./layout').name, require('./layout').name,
require('./device-list').name, require('./device-list').name,
require('./device-control').name,
require('./control-panes').name, require('./control-panes').name,
require('./menu').name, require('./menu').name,
require('./settings').name, require('./settings').name,

View file

@ -1,4 +1,4 @@
module.exports = function ControlPanesCtrl($scope, gettext) { module.exports = function ($scope, gettext, $routeParams, $location, DeviceService, GroupService, ControlService) {
var sharedTabs = [ var sharedTabs = [
{ {
@ -52,4 +52,20 @@ module.exports = function ControlPanesCtrl($scope, gettext) {
].concat(angular.copy(sharedTabs)) ].concat(angular.copy(sharedTabs))
$scope.device = null
$scope.control = null
DeviceService.get($routeParams.serial, $scope)
.then(function (device) {
return GroupService.invite(device)
})
.then(function (device) {
$scope.device = device
$scope.control = ControlService.create(device, device.channel)
return device
})
.catch(function () {
$location.path('/')
})
} }

View file

@ -1,11 +1,14 @@
div(pane, pane-anchor='west', pane-size='30% + 2px', pane-min='200px', pane-max='100% + 2px', pane-handle='4') div
//.stf-catch-all-keys(ng-controller='KeysCtrl') div(pane, pane-anchor='west', pane-size='30% + 2px', pane-min='200px', pane-max='100% + 2px', pane-handle='4')
catch-all-keys(keys-down='keysDown($event)', keys-up='keysUp($event)') //.stf-catch-all-keys(ng-controller='KeysCtrl')
.remote-control catch-all-keys(keys-down='keysDown($event)', keys-up='keysUp($event)')
//include control-screen .remote-control
div(pane, pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p //include control-screen
.widget-container.fluid-height div(ng-include='"control-panes/device-control/device-control.jade"')
nice-tabs(key='ControlBottomTabs', direction='below', tabs='belowTabs', filter='$root.platform')
div(pane, pane-anchor='') div(pane, pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p
.widget-container.fluid-height .widget-container.fluid-height
nice-tabs(key='ControlBottomTabs', tabs='topTabs', filter='$root.platform') nice-tabs(key='ControlBottomTabs', direction='below', tabs='belowTabs', filter='$root.platform')
div(pane, pane-anchor='')
.widget-container.fluid-height
nice-tabs(key='ControlBottomTabs', tabs='topTabs', filter='$root.platform')

View file

@ -1,3 +1,21 @@
module.exports = function UploadCtrl($scope) { module.exports = function UploadCtrl($scope) {
$scope.installation = null
$scope.install = function ($files) {
return $scope.control.install($files)
.then(function (tx) {
return tx.promise
.progressed(function (result) {
$scope.$apply(function () {
$scope.installation = result
})
})
.then(function (result) {
$scope.$apply(function () {
$scope.installation = result
})
})
})
}
} }

View file

@ -1,6 +1,6 @@
.widget-container.fluid-height.stf-upload(ng-controller='UploadCtrl') .widget-container.fluid-height.stf-upload(ng-controller='UploadCtrl')
.heading .heading
i.fa i.fa.fa-upload
span(translate) Upload span(translate) Upload
.widget-content.padded .widget-content.padded
div div

View file

@ -0,0 +1,42 @@
//module.exports = function DeviceControlCtrl(
// $scope
//, $routeParams
//, $location
//, DeviceService
//, GroupService
//, ControlService
//) {
// $scope.device = null
// $scope.control = null
// $scope.installation = null
//
// $scope.install = function($files) {
// return $scope.control.install($files)
// .then(function(tx) {
// return tx.promise
// .progressed(function(result) {
// $scope.$apply(function() {
// $scope.installation = result
// })
// })
// .then(function(result) {
// $scope.$apply(function() {
// $scope.installation = result
// })
// })
// })
// }
//
// DeviceService.get($routeParams.serial, $scope)
// .then(function(device) {
// return GroupService.invite(device)
// })
// .then(function(device) {
// $scope.device = device
// $scope.control = ControlService.create(device, device.channel)
// return device
// })
// .catch(function() {
// $location.path('/')
// })
//}

View file

@ -0,0 +1,13 @@
require('./device-control.css')
module.exports = angular.module('device-control', [
require('stf/device').name,
require('stf/control').name,
require('stf/screen').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/device-control/device-control.jade',
require('./device-control.jade')
)
}])
// .controller('DeviceControlCtrl', require('./device-control-controller'))

View file

@ -4,6 +4,9 @@ require('fa-borderlayout/build-0.3.1/stf-style.css')
module.exports = angular.module('control-panes', [ module.exports = angular.module('control-panes', [
require('stf/common-ui/nice-tabs').name, require('stf/common-ui/nice-tabs').name,
require('stf/device').name,
require('stf/control').name,
require('./device-control').name,
require('./advanced').name, require('./advanced').name,
require('./cpu').name, require('./cpu').name,
require('./dashboard').name, require('./dashboard').name,
@ -13,10 +16,16 @@ module.exports = angular.module('control-panes', [
require('./screenshots').name require('./screenshots').name
]) ])
.config(['$routeProvider', function ($routeProvider) { .config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/control-panes', { $routeProvider.when('/control/:serial', {
template: require('./control-panes.jade'), template: require('./control-panes.jade'),
controller: 'ControlPanesCtrl' controller: 'ControlPanesCtrl'
}) })
}]) }])
// .config(['$routeProvider', function ($routeProvider) {
// $routeProvider.when('/control-panes', {
// template: require('./control-panes.jade'),
// controller: 'ControlPanesCtrl'
// })
// }])
.factory('ControlPanesService', require('./control-panes-service')) .factory('ControlPanesService', require('./control-panes-service'))
.controller('ControlPanesCtrl', require('./control-panes-controller')) .controller('ControlPanesCtrl', require('./control-panes-controller'))

View file

@ -1,42 +0,0 @@
module.exports = function DeviceControlCtrl(
$scope
, $routeParams
, $location
, DeviceService
, GroupService
, ControlService
) {
$scope.device = null
$scope.control = null
$scope.installation = null
$scope.install = function($files) {
return $scope.control.install($files)
.then(function(tx) {
return tx.promise
.progressed(function(result) {
$scope.$apply(function() {
$scope.installation = result
})
})
.then(function(result) {
$scope.$apply(function() {
$scope.installation = result
})
})
})
}
DeviceService.get($routeParams.serial, $scope)
.then(function(device) {
return GroupService.invite(device)
})
.then(function(device) {
$scope.device = device
$scope.control = ControlService.create(device, device.channel)
return device
})
.catch(function() {
$location.path('/')
})
}

View file

@ -1,14 +0,0 @@
require('./device-control.css')
module.exports = angular.module('device-control', [
require('stf/device').name,
require('stf/control').name,
require('stf/screen').name
])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/control/:serial', {
template: require('./device-control.jade'),
controller: 'DeviceControlCtrl'
})
}])
.controller('DeviceControlCtrl', require('./device-control-controller'))