summaryrefslogtreecommitdiffstats
path: root/app/server-control/controllers/remote-console-window-controller.js
blob: d9a342f02217dbdb634a9b18160cb28e601c5c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * Controller for server
 *
 * @module app/serverControl
 * @exports remoteConsoleWindowController
 * @name remoteConsoleController
 */

window.angular && (function (angular) {
    'use strict';

    angular
        .module('app.serverControl')
        .controller('remoteConsoleWindowController', [
            '$scope',
            '$window',
            'APIUtils',
            'dataService',
            function($scope, $window, APIUtils, dataService){
                $scope.dataService = dataService;
                dataService.showNavigation = false;

                // See https://github.com/macton/hterm for available hterm options

                //Storage
                hterm.defaultStorage = new lib.Storage.Local();

                var term = new hterm.Terminal("foo");
                term.onTerminalReady = function() {
                    var io = term.io.push();
                    io.onVTKeystroke = function(str) {
                        console.log(str)
                        term.io.print(str);
                    };
                    io.sendString = function(str) {
                        console.log(str)
                    };
                };
                term.decorate(document.querySelector('#terminal'));

                //Set cursor color
                term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');

                //Set background color
                term.prefs_.set('background-color', '#19273c');

                //Print to console window
                term.io.println('OpenBMC ver.00');
                term.io.println('This is not an actual live connection.');
                term.io.print('root@IBM:');

                //Allows keyboard input
                term.installKeyboard();

                $scope.close = function(){
                    dataService.setRemoteWindowInactive();
                    $window.close();
                }
            }
        ]
    );

})(angular);
OpenPOWER on IntegriCloud