mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
- Improving the shell. Still not a real shell.
This commit is contained in:
parent
e17f306d30
commit
af47e535e4
10 changed files with 95 additions and 13 deletions
|
@ -5,5 +5,6 @@ module.exports = angular.module('stf/common-ui', [
|
||||||
require('./nothing-to-show').name,
|
require('./nothing-to-show').name,
|
||||||
require('./table').name,
|
require('./table').name,
|
||||||
require('./notifications').name,
|
require('./notifications').name,
|
||||||
require('./ng-enter').name
|
require('./ng-enter').name,
|
||||||
|
require('./tooltips').name
|
||||||
])
|
])
|
16
res/app/components/stf/common-ui/tooltips/README.md
Normal file
16
res/app/components/stf/common-ui/tooltips/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# stf-tooltips
|
||||||
|
|
||||||
|
Based on Angular Bootstrap.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```html
|
||||||
|
help-title='{{"Run Command"|translate}}'
|
||||||
|
help-key='Enter'
|
||||||
|
```
|
||||||
|
|
||||||
|
Maps to:
|
||||||
|
|
||||||
|
```html
|
||||||
|
tooltip-html-unsafe='{{"Run Command<br /><br /><code>Enter</code>"|translate}}'
|
||||||
|
```
|
4
res/app/components/stf/common-ui/tooltips/index.js
Normal file
4
res/app/components/stf/common-ui/tooltips/index.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = angular.module('stf.tooltips', [
|
||||||
|
|
||||||
|
])
|
||||||
|
.directive('tooltips', require('./tooltips-directive'))
|
|
@ -0,0 +1,8 @@
|
||||||
|
module.exports = function tooltipsDirective() {
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function (scope, element, attrs) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
res/app/components/stf/common-ui/tooltips/tooltips-spec.js
Normal file
23
res/app/components/stf/common-ui/tooltips/tooltips-spec.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
describe('tooltips', function () {
|
||||||
|
|
||||||
|
beforeEach(module('stf.tooltips'));
|
||||||
|
|
||||||
|
var scope, compile;
|
||||||
|
|
||||||
|
beforeEach(inject(function ($rootScope, $compile) {
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
compile = $compile;
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should ...', function () {
|
||||||
|
|
||||||
|
/*
|
||||||
|
To test your directive, you need to create some html that would use your directive,
|
||||||
|
send that through compile() then compare the results.
|
||||||
|
|
||||||
|
var element = compile('<div tooltips name="name">hi</div>')(scope);
|
||||||
|
expect(element.text()).toBe('hello, world');
|
||||||
|
*/
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +1,7 @@
|
||||||
require('./shell.css')
|
require('./shell.css')
|
||||||
|
|
||||||
module.exports = angular.module('stf.shell', [
|
module.exports = angular.module('stf.shell', [
|
||||||
|
require('stf/common-ui').name
|
||||||
])
|
])
|
||||||
.run(["$templateCache", function ($templateCache) {
|
.run(["$templateCache", function ($templateCache) {
|
||||||
$templateCache.put('control-panes/dashboard/shell/shell.jade',
|
$templateCache.put('control-panes/dashboard/shell/shell.jade',
|
||||||
|
|
|
@ -1,16 +1,34 @@
|
||||||
module.exports = function ShellCtrl($scope, $rootScope) {
|
module.exports = function ShellCtrl($scope, $rootScope) {
|
||||||
$scope.results = []
|
// TODO: implement multiple devices
|
||||||
|
// $scope.results = []
|
||||||
|
$scope.result = null
|
||||||
|
|
||||||
|
$scope.referenceUrl = 'https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference'
|
||||||
|
|
||||||
$scope.run = function(command) {
|
$scope.run = function(command) {
|
||||||
|
if (command === 'clear') {
|
||||||
|
$scope.clear()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var cmd = $rootScope.control.shell(command)
|
var cmd = $rootScope.control.shell(command)
|
||||||
|
$scope.command = ''
|
||||||
|
|
||||||
return cmd.promise
|
return cmd.promise
|
||||||
.progressed(function(results) {
|
.progressed(function(result) {
|
||||||
$scope.results = results
|
//$scope.result = result
|
||||||
|
$scope.data = result.data.join('')
|
||||||
$scope.$digest()
|
$scope.$digest()
|
||||||
})
|
})
|
||||||
.then(function(results) {
|
.then(function(result) {
|
||||||
$scope.results = results
|
$scope.data = result.data.join('')
|
||||||
|
// $scope.result = result
|
||||||
$scope.$digest()
|
$scope.$digest()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.clear = function () {
|
||||||
|
$scope.command = ''
|
||||||
|
$scope.data = ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
.stf-shell {
|
.stf-shell .shell-results {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fefefe;
|
||||||
|
background: #444;
|
||||||
}
|
}
|
|
@ -2,14 +2,20 @@
|
||||||
.heading
|
.heading
|
||||||
i.fa.fa-terminal
|
i.fa.fa-terminal
|
||||||
span(translate) Shell
|
span(translate) Shell
|
||||||
|
clear-button(ng-click='clear()', ng-disabled='!command && !data').btn-xs
|
||||||
|
a(ng-href='{{referenceUrl}}', target='_href').btn.btn-xs.btn-primary-outline.pull-right
|
||||||
|
i.fa.fa-book
|
||||||
|
span(translate) Reference
|
||||||
.widget-content.padded
|
.widget-content.padded
|
||||||
a(href='https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference', target='_href') Reference
|
|
||||||
.input-group.form-inline
|
.input-group.form-inline
|
||||||
input(type=text, ng-model='command', ng-enter='run(command)').form-control
|
input(type=text, ng-model='command', ng-enter='run(command)').form-control
|
||||||
span.input-group-btn
|
span.input-group-btn
|
||||||
button.btn.btn-primary-outline(ng-click='run(command)')
|
button.btn.btn-primary-outline(ng-click='run(command)', tooltip-html-unsafe='{{"Run Command"|translate}}<br /><br /><code>Enter</code>')
|
||||||
i.fa.fa-play
|
i.fa.fa-play
|
||||||
table
|
pre.shell-results(ng-show='data') {{data}}
|
||||||
|
|
||||||
|
// table
|
||||||
tr(ng-repeat='result in results track by result.device.serial')
|
tr(ng-repeat='result in results track by result.device.serial')
|
||||||
td {{ result.device.serial }}
|
td {{ result.device.serial }}
|
||||||
td {{ result.data }}
|
td {{ result.data }}
|
|
@ -5,7 +5,11 @@
|
||||||
.stf-vnc-navbar.as-row
|
.stf-vnc-navbar.as-row
|
||||||
a.stf-vnc-device-name.cursor.dropdown-toggle
|
a.stf-vnc-device-name.cursor.dropdown-toggle
|
||||||
p {{ $root.device.serial }} {{ $root.device.present ? 'present' : 'absent' }}
|
p {{ $root.device.serial }} {{ $root.device.present ? 'present' : 'absent' }}
|
||||||
button(ng-click='showScreen = !showScreen') Show/Hide
|
.pull-right
|
||||||
|
button(type='button', ng-model='showScreen', btn-checkbox).btn.btn-sm.btn-danger
|
||||||
|
i(ng-show='showScreen', tooltip-html-unsafe='{{"Just control device"|translate}}<br /><code>⌘-⇧-O</code>', tooltip-placement='left').fa.fa-eye
|
||||||
|
i(ng-show='!showScreen', tooltip-html-unsafe='{{"View device"|translate}}<br /><code>⌘-⇧-O</code>', tooltip-placement='left').fa.fa-eye-slash
|
||||||
|
//button(ng-click='showScreen = !showScreen') Show/Hide
|
||||||
button(ng-click='$root.control.identify()') Identify
|
button(ng-click='$root.control.identify()') Identify
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue