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