blob: aa0e152a50f78865f22da30099b66642e4cb5f75 [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
7 * @version 0.1.0
8 */
9
10window.angular && (function (angular) {
11 'use strict';
12
13 angular
14 .module('app.serverControl')
15 .controller('remoteConsoleWindowController', [
Gunnar Millseedefd32018-02-28 17:02:34 -060016 '$scope',
17 '$window',
18 'APIUtils',
Iftekharul Islamc22425f2017-09-06 10:04:14 -050019 '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
Gunnar Millseedefd32018-02-28 17:02:34 -060025
Iftekharul Islamc22425f2017-09-06 10:04:14 -050026 //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:');
Gunnar Millseedefd32018-02-28 17:02:34 -060052
Iftekharul Islamc22425f2017-09-06 10:04:14 -050053 //Allows keyboard input
54 term.installKeyboard();
55
56 $scope.close = function(){
57 dataService.setRemoteWindowInactive();
58 $window.close();
59 }
60 }
61 ]
62 );
63
64})(angular);