blob: 8081972db9133b59bede99fbc4ce74d07bd9c441 [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
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07009window.angular && (function(angular) {
10 'use strict';
Iftekharul Islamc22425f2017-09-06 10:04:14 -050011
Andrew Geisslerd27bb132018-05-24 11:07:27 -070012 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;
Iftekharul Islamc22425f2017-09-06 10:04:14 -050018
Andrew Geisslerd27bb132018-05-24 11:07:27 -070019 // See https://github.com/macton/hterm for available hterm options
Gunnar Millseedefd32018-02-28 17:02:34 -060020
Andrew Geisslerd27bb132018-05-24 11:07:27 -070021 // Storage
22 hterm.defaultStorage = new lib.Storage.Local();
Iftekharul Islamc22425f2017-09-06 10:04:14 -050023
Andrew Geisslerd27bb132018-05-24 11:07:27 -070024 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 };
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070034 };
Andrew Geisslerd27bb132018-05-24 11:07:27 -070035 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();
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070054 };
Andrew Geisslerd27bb132018-05-24 11:07:27 -070055 }
56 ]);
Iftekharul Islamc22425f2017-09-06 10:04:14 -050057})(angular);