1/**
2 * Controller for server
3 *
4 * @module app/serverControl
5 * @exports remoteConsoleWindowController
6 * @name remoteConsoleController
7 * @version 0.1.0
8 */
9
10window.angular && (function (angular) {
11    'use strict';
12
13    angular
14        .module('app.serverControl')
15        .controller('remoteConsoleWindowController', [
16            '$scope',
17            '$window',
18            'APIUtils',
19            'dataService',
20            function($scope, $window, APIUtils, dataService){
21                $scope.dataService = dataService;
22                dataService.showNavigation = false;
23
24                // See https://github.com/macton/hterm for available hterm options
25
26                //Storage
27                hterm.defaultStorage = new lib.Storage.Local();
28
29                var term = new hterm.Terminal("foo");
30                term.onTerminalReady = function() {
31                    var io = term.io.push();
32                    io.onVTKeystroke = function(str) {
33                        console.log(str)
34                        term.io.print(str);
35                    };
36                    io.sendString = function(str) {
37                        console.log(str)
38                    };
39                };
40                term.decorate(document.querySelector('#terminal'));
41
42                //Set cursor color
43                term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
44
45                //Set background color
46                term.prefs_.set('background-color', '#19273c');
47
48                //Print to console window
49                term.io.println('OpenBMC ver.00');
50                term.io.println('This is not an actual live connection.');
51                term.io.print('root@IBM:');
52
53                //Allows keyboard input
54                term.installKeyboard();
55
56                $scope.close = function(){
57                    dataService.setRemoteWindowInactive();
58                    $window.close();
59                }
60            }
61        ]
62    );
63
64})(angular);
65