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:
parent
e173a4f648
commit
f8a4fee2bb
12 changed files with 116 additions and 72 deletions
|
@ -11,7 +11,6 @@ angular.module('app', [
|
|||
'angularFileUpload',
|
||||
require('./layout').name,
|
||||
require('./device-list').name,
|
||||
require('./device-control').name,
|
||||
require('./control-panes').name,
|
||||
require('./menu').name,
|
||||
require('./settings').name,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function ControlPanesCtrl($scope, gettext) {
|
||||
module.exports = function ($scope, gettext, $routeParams, $location, DeviceService, GroupService, ControlService) {
|
||||
|
||||
var sharedTabs = [
|
||||
{
|
||||
|
@ -52,4 +52,20 @@ module.exports = function ControlPanesCtrl($scope, gettext) {
|
|||
].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('/')
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
div(pane, pane-anchor='west', pane-size='30% + 2px', pane-min='200px', pane-max='100% + 2px', pane-handle='4')
|
||||
//.stf-catch-all-keys(ng-controller='KeysCtrl')
|
||||
catch-all-keys(keys-down='keysDown($event)', keys-up='keysUp($event)')
|
||||
.remote-control
|
||||
//include control-screen
|
||||
div(pane, pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p
|
||||
.widget-container.fluid-height
|
||||
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')
|
||||
div
|
||||
div(pane, pane-anchor='west', pane-size='30% + 2px', pane-min='200px', pane-max='100% + 2px', pane-handle='4')
|
||||
//.stf-catch-all-keys(ng-controller='KeysCtrl')
|
||||
catch-all-keys(keys-down='keysDown($event)', keys-up='keysUp($event)')
|
||||
.remote-control
|
||||
//include control-screen
|
||||
div(ng-include='"control-panes/device-control/device-control.jade"')
|
||||
|
||||
div(pane, pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p
|
||||
.widget-container.fluid-height
|
||||
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')
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
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
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.widget-container.fluid-height.stf-upload(ng-controller='UploadCtrl')
|
||||
.heading
|
||||
i.fa
|
||||
i.fa.fa-upload
|
||||
span(translate) Upload
|
||||
.widget-content.padded
|
||||
div
|
||||
|
|
|
@ -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('/')
|
||||
// })
|
||||
//}
|
13
res/app/control-panes/device-control/index.js
Normal file
13
res/app/control-panes/device-control/index.js
Normal 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'))
|
|
@ -4,6 +4,9 @@ require('fa-borderlayout/build-0.3.1/stf-style.css')
|
|||
|
||||
module.exports = angular.module('control-panes', [
|
||||
require('stf/common-ui/nice-tabs').name,
|
||||
require('stf/device').name,
|
||||
require('stf/control').name,
|
||||
require('./device-control').name,
|
||||
require('./advanced').name,
|
||||
require('./cpu').name,
|
||||
require('./dashboard').name,
|
||||
|
@ -13,10 +16,16 @@ module.exports = angular.module('control-panes', [
|
|||
require('./screenshots').name
|
||||
])
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/control-panes', {
|
||||
$routeProvider.when('/control/:serial', {
|
||||
template: require('./control-panes.jade'),
|
||||
controller: 'ControlPanesCtrl'
|
||||
})
|
||||
}])
|
||||
// .config(['$routeProvider', function ($routeProvider) {
|
||||
// $routeProvider.when('/control-panes', {
|
||||
// template: require('./control-panes.jade'),
|
||||
// controller: 'ControlPanesCtrl'
|
||||
// })
|
||||
// }])
|
||||
.factory('ControlPanesService', require('./control-panes-service'))
|
||||
.controller('ControlPanesCtrl', require('./control-panes-controller'))
|
||||
|
|
|
@ -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('/')
|
||||
})
|
||||
}
|
|
@ -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'))
|
Loading…
Add table
Add a link
Reference in a new issue