diff --git a/res/app/components/stf/common-ui/index.js b/res/app/components/stf/common-ui/index.js index 40b382a8..4cc5015c 100644 --- a/res/app/components/stf/common-ui/index.js +++ b/res/app/components/stf/common-ui/index.js @@ -5,5 +5,6 @@ module.exports = angular.module('stf/common-ui', [ require('./nothing-to-show').name, require('./table').name, require('./notifications').name, - require('./ng-enter').name + require('./ng-enter').name, + require('./tooltips').name ]) \ No newline at end of file diff --git a/res/app/components/stf/common-ui/tooltips/README.md b/res/app/components/stf/common-ui/tooltips/README.md new file mode 100644 index 00000000..e71cf30c --- /dev/null +++ b/res/app/components/stf/common-ui/tooltips/README.md @@ -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

Enter"|translate}}' +``` \ No newline at end of file diff --git a/res/app/components/stf/common-ui/tooltips/index.js b/res/app/components/stf/common-ui/tooltips/index.js new file mode 100644 index 00000000..9dc4aaff --- /dev/null +++ b/res/app/components/stf/common-ui/tooltips/index.js @@ -0,0 +1,4 @@ +module.exports = angular.module('stf.tooltips', [ + +]) + .directive('tooltips', require('./tooltips-directive')) diff --git a/res/app/components/stf/common-ui/tooltips/tooltips-directive.js b/res/app/components/stf/common-ui/tooltips/tooltips-directive.js new file mode 100644 index 00000000..487418df --- /dev/null +++ b/res/app/components/stf/common-ui/tooltips/tooltips-directive.js @@ -0,0 +1,8 @@ +module.exports = function tooltipsDirective() { + return { + restrict: 'A', + link: function (scope, element, attrs) { + + } + } +} diff --git a/res/app/components/stf/common-ui/tooltips/tooltips-spec.js b/res/app/components/stf/common-ui/tooltips/tooltips-spec.js new file mode 100644 index 00000000..d1567bd2 --- /dev/null +++ b/res/app/components/stf/common-ui/tooltips/tooltips-spec.js @@ -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('
hi
')(scope); + expect(element.text()).toBe('hello, world'); + */ + + }); +}); \ No newline at end of file diff --git a/res/app/control-panes/dashboard/shell/index.js b/res/app/control-panes/dashboard/shell/index.js index 4d29fdbd..70055609 100644 --- a/res/app/control-panes/dashboard/shell/index.js +++ b/res/app/control-panes/dashboard/shell/index.js @@ -1,7 +1,7 @@ require('./shell.css') module.exports = angular.module('stf.shell', [ - + require('stf/common-ui').name ]) .run(["$templateCache", function ($templateCache) { $templateCache.put('control-panes/dashboard/shell/shell.jade', diff --git a/res/app/control-panes/dashboard/shell/shell-controller.js b/res/app/control-panes/dashboard/shell/shell-controller.js index f29406de..b1452f16 100644 --- a/res/app/control-panes/dashboard/shell/shell-controller.js +++ b/res/app/control-panes/dashboard/shell/shell-controller.js @@ -1,16 +1,34 @@ 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) { + if (command === 'clear') { + $scope.clear() + return + } + var cmd = $rootScope.control.shell(command) + $scope.command = '' + return cmd.promise - .progressed(function(results) { - $scope.results = results + .progressed(function(result) { + //$scope.result = result + $scope.data = result.data.join('') $scope.$digest() }) - .then(function(results) { - $scope.results = results + .then(function(result) { + $scope.data = result.data.join('') +// $scope.result = result $scope.$digest() }) } + + $scope.clear = function () { + $scope.command = '' + $scope.data = '' + } } diff --git a/res/app/control-panes/dashboard/shell/shell.css b/res/app/control-panes/dashboard/shell/shell.css index 24ef92d8..55bce68f 100644 --- a/res/app/control-panes/dashboard/shell/shell.css +++ b/res/app/control-panes/dashboard/shell/shell.css @@ -1,3 +1,5 @@ -.stf-shell { - +.stf-shell .shell-results { + font-size: 12px; + color: #fefefe; + background: #444; } \ No newline at end of file diff --git a/res/app/control-panes/dashboard/shell/shell.jade b/res/app/control-panes/dashboard/shell/shell.jade index 214338e8..65fa0593 100644 --- a/res/app/control-panes/dashboard/shell/shell.jade +++ b/res/app/control-panes/dashboard/shell/shell.jade @@ -2,14 +2,20 @@ .heading i.fa.fa-terminal 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 - a(href='https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference', target='_href') Reference + .input-group.form-inline input(type=text, ng-model='command', ng-enter='run(command)').form-control 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}}

Enter') i.fa.fa-play - table + pre.shell-results(ng-show='data') {{data}} + + // table tr(ng-repeat='result in results track by result.device.serial') td {{ result.device.serial }} td {{ result.data }} \ No newline at end of file diff --git a/res/app/control-panes/device-control/device-control.jade b/res/app/control-panes/device-control/device-control.jade index 9812d7af..f057f1ce 100644 --- a/res/app/control-panes/device-control/device-control.jade +++ b/res/app/control-panes/device-control/device-control.jade @@ -5,7 +5,11 @@ .stf-vnc-navbar.as-row a.stf-vnc-device-name.cursor.dropdown-toggle 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}}
⌘-⇧-O', tooltip-placement='left').fa.fa-eye + i(ng-show='!showScreen', tooltip-html-unsafe='{{"View device"|translate}}
⌘-⇧-O', tooltip-placement='left').fa.fa-eye-slash + //button(ng-click='showScreen = !showScreen') Show/Hide button(ng-click='$root.control.identify()') Identify