0
0
mirror of https://github.com/dobin/lxd-webgui synced 2025-10-05 23:52:43 +02:00
Files
dobin-lxd-webgui/modules/terminal/TerminalController.js
2016-09-11 16:18:30 +02:00

32 lines
1.1 KiB
JavaScript

'use strict';
angular.module('myApp.terminal', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/terminal/:containerName', {
title: 'Terminal',
templateUrl: 'modules/terminal/terminal.html',
controller: 'terminalPageCtrl',
})
;
}])
.controller('terminalPageCtrl', function ($scope, $routeParams, $filter, $location,
TerminalServices, SettingServices) {
$scope.containerName = $routeParams.containerName;
var container = {};
// get JS terminal emulator
container.terminal = TerminalServices.getJavascriptTerminal();
container.terminal.open(document.getElementById('console'));
var initialGeometry = container.terminal.proposeGeometry();
console.log("Rows: " + initialGeometry.rows + " Cols: " + initialGeometry.cols);
TerminalServices.getTerminal2($scope.containerName, container.terminal, initialGeometry).then(function(term) {
container.terminal.fit();
});
})
;