blob: d9a342f02217dbdb634a9b18160cb28e601c5c3f [file] [log] [blame]
Iftekharul Islamc22425f2017-09-06 10:04:14 -05001/**
2 * Controller for server
3 *
4 * @module app/serverControl
5 * @exports remoteConsoleWindowController
6 * @name remoteConsoleController
Iftekharul Islamc22425f2017-09-06 10:04:14 -05007 */
8
9window.angular && (function (angular) {
10 'use strict';
11
12 angular
13 .module('app.serverControl')
14 .controller('remoteConsoleWindowController', [
Gunnar Millseedefd32018-02-28 17:02:34 -060015 '$scope',
16 '$window',
17 'APIUtils',
Iftekharul Islamc22425f2017-09-06 10:04:14 -050018 '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
Gunnar Millseedefd32018-02-28 17:02:34 -060024
Iftekharul Islamc22425f2017-09-06 10:04:14 -050025 //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:');
Gunnar Millseedefd32018-02-28 17:02:34 -060051
Iftekharul Islamc22425f2017-09-06 10:04:14 -050052 //Allows keyboard input
53 term.installKeyboard();
54
55 $scope.close = function(){
56 dataService.setRemoteWindowInactive();
57 $window.close();
58 }
59 }
60 ]
61 );
62
63})(angular);