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