summaryrefslogtreecommitdiffstats
path: root/app/server-control
diff options
context:
space:
mode:
authorAndrew Geissler <geissonator@yahoo.com>2018-05-24 10:58:00 -0700
committerAndrew Geissler <geissonator@yahoo.com>2018-05-24 10:58:00 -0700
commitba5e3f3484c0de46f4f5fc5baf5804648179a9eb (patch)
tree5bfff42d64b4aac4339fc76a5b6e76f2556b723c /app/server-control
parent13251a8e57f3c5bd200ddd7dd42ef4e9af110429 (diff)
downloadphosphor-webui-ba5e3f3484c0de46f4f5fc5baf5804648179a9eb.tar.gz
phosphor-webui-ba5e3f3484c0de46f4f5fc5baf5804648179a9eb.zip
Run js-beautify and fixjsstyle on code
Found this pointer on stackoverflow: https://stackoverflow.com/a/31660434/5508494 End goal is to get the code formatted well enough that clang format will run correctly against it. Change-Id: I80053e78d253d8eee49233e42d55e5807ae8fdc8 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'app/server-control')
-rw-r--r--app/server-control/controllers/bmc-reboot-controller.js55
-rw-r--r--app/server-control/controllers/power-operations-controller.js562
-rw-r--r--app/server-control/controllers/remote-console-controller.js121
-rw-r--r--app/server-control/controllers/remote-console-window-controller.js105
-rw-r--r--app/server-control/index.js84
5 files changed, 471 insertions, 456 deletions
diff --git a/app/server-control/controllers/bmc-reboot-controller.js b/app/server-control/controllers/bmc-reboot-controller.js
index 9899eed..8be09eb 100644
--- a/app/server-control/controllers/bmc-reboot-controller.js
+++ b/app/server-control/controllers/bmc-reboot-controller.js
@@ -6,34 +6,33 @@
* @name bmcRebootController
*/
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.serverControl')
- .controller('bmcRebootController', [
- '$scope',
- '$window',
- 'APIUtils',
- 'dataService',
- function($scope, $window, APIUtils, dataService){
- $scope.dataService = dataService;
- $scope.confirm = false;
- $scope.rebootConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- };
- $scope.reboot = function(){
- dataService.setUnreachableState();
- APIUtils.bmcReboot(function(response){
- //@NOTE: using common event to reload server status, may be a better event listener name?
- $scope.$emit('user-logged-in',{});
- });
- };
- }
- ]
- );
+ angular
+ .module('app.serverControl')
+ .controller('bmcRebootController', [
+ '$scope',
+ '$window',
+ 'APIUtils',
+ 'dataService',
+ function($scope, $window, APIUtils, dataService) {
+ $scope.dataService = dataService;
+ $scope.confirm = false;
+ $scope.rebootConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ };
+ $scope.reboot = function() {
+ dataService.setUnreachableState();
+ APIUtils.bmcReboot(function(response) {
+ //@NOTE: using common event to reload server status, may be a better event listener name?
+ $scope.$emit('user-logged-in', {});
+ });
+ };
+ }
+ ]);
})(angular);
diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js
index 910c50e..06fb371 100644
--- a/app/server-control/controllers/power-operations-controller.js
+++ b/app/server-control/controllers/power-operations-controller.js
@@ -6,291 +6,305 @@
* @name powerOperationsController
*/
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.serverControl')
- .controller('powerOperationsController', [
- '$scope',
- 'APIUtils',
- 'dataService',
- 'Constants',
- '$timeout',
- '$interval',
- '$interpolate',
- '$q',
- function($scope, APIUtils, dataService, Constants, $timeout,
- $interval, $interpolate, $q){
- $scope.dataService = dataService;
- $scope.confirm = false;
- $scope.power_confirm = false;
- $scope.warmboot_confirm = false;
- $scope.coldboot_confirm = false;
- $scope.orderly_confirm = false;
- $scope.immediately_confirm = false;
- $scope.loading = false;
+ angular
+ .module('app.serverControl')
+ .controller('powerOperationsController', [
+ '$scope',
+ 'APIUtils',
+ 'dataService',
+ 'Constants',
+ '$timeout',
+ '$interval',
+ '$interpolate',
+ '$q',
+ function($scope, APIUtils, dataService, Constants, $timeout,
+ $interval, $interpolate, $q) {
+ $scope.dataService = dataService;
+ $scope.confirm = false;
+ $scope.power_confirm = false;
+ $scope.warmboot_confirm = false;
+ $scope.coldboot_confirm = false;
+ $scope.orderly_confirm = false;
+ $scope.immediately_confirm = false;
+ $scope.loading = false;
- var pollChassisStatusTimer = undefined;
- var pollHostStatusTimer = undefined;
- var pollStartTime = null;
+ var pollChassisStatusTimer = undefined;
+ var pollHostStatusTimer = undefined;
+ var pollStartTime = null;
- //@TODO: call api and get proper state
- $scope.toggleState = function(){
- dataService.server_state = (dataService.server_state == 'Running') ? 'Off': 'Running';
- }
+ //@TODO: call api and get proper state
+ $scope.toggleState = function() {
+ dataService.server_state = (dataService.server_state == 'Running') ? 'Off' : 'Running';
+ };
- $scope.powerOn = function(){
- $scope.loading = true;
- dataService.setUnreachableState();
- APIUtils.hostPowerOn().then(function(response){
- return response;
- }).then(function(lastStatus) {
- pollStartTime = new Date();
- return pollHostStatusTillOn();
- }).then(function(hostState) {
- $scope.loading = false;
- }).catch(function(error){
- dataService.activateErrorModal(
- {title: Constants.MESSAGES.POWER_OP.POWER_ON_FAILED,
- description: error.statusText ?
- $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)(
- {status: error.status, description: error.statusText}) :
- error });
- $scope.loading = false;
- });
- }
- $scope.powerOnConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- $scope.power_confirm = true;
- };
+ $scope.powerOn = function() {
+ $scope.loading = true;
+ dataService.setUnreachableState();
+ APIUtils.hostPowerOn().then(function(response) {
+ return response;
+ }).then(function(lastStatus) {
+ pollStartTime = new Date();
+ return pollHostStatusTillOn();
+ }).then(function(hostState) {
+ $scope.loading = false;
+ }).catch(function(error) {
+ dataService.activateErrorModal({
+ title: Constants.MESSAGES.POWER_OP.POWER_ON_FAILED,
+ description: error.statusText ?
+ $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)({
+ status: error.status,
+ description: error.statusText
+ }) : error
+ });
+ $scope.loading = false;
+ });
+ };
+ $scope.powerOnConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ $scope.power_confirm = true;
+ };
- function setHostState(state){
- if(state == Constants.HOST_STATE_TEXT.off_code){
- dataService.setPowerOffState();
- }else if(state == Constants.HOST_STATE_TEXT.on_code){
- dataService.setPowerOnState();
- }else{
- dataService.setErrorState();
- }
- }
+ function setHostState(state) {
+ if (state == Constants.HOST_STATE_TEXT.off_code) {
+ dataService.setPowerOffState();
+ }
+ else if (state == Constants.HOST_STATE_TEXT.on_code) {
+ dataService.setPowerOnState();
+ }
+ else {
+ dataService.setErrorState();
+ }
+ }
- function pollChassisStatusTillOff(){
- var deferred = $q.defer();
- pollChassisStatusTimer = $interval(function(){
- var now = new Date();
- if((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.CHASSIS_OFF){
- $interval.cancel(pollChassisStatusTimer);
- pollChassisStatusTimer = undefined;
- deferred.reject(new Error(Constants.MESSAGES.POLL.CHASSIS_OFF_TIMEOUT));
- }
- APIUtils.getChassisState().then(function(state){
- if(state === Constants.CHASSIS_POWER_STATE.off_code){
- $interval.cancel(pollChassisStatusTimer);
- pollChassisStatusTimer = undefined;
- deferred.resolve(state);
- }
- }).catch(function(error){
- $interval.cancel(pollChassisStatusTimer);
- pollChassisStatusTimer = undefined;
- deferred.reject(error);
- });
- }, Constants.POLL_INTERVALS.POWER_OP);
+ function pollChassisStatusTillOff() {
+ var deferred = $q.defer();
+ pollChassisStatusTimer = $interval(function() {
+ var now = new Date();
+ if ((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.CHASSIS_OFF) {
+ $interval.cancel(pollChassisStatusTimer);
+ pollChassisStatusTimer = undefined;
+ deferred.reject(new Error(Constants.MESSAGES.POLL.CHASSIS_OFF_TIMEOUT));
+ }
+ APIUtils.getChassisState().then(function(state) {
+ if (state === Constants.CHASSIS_POWER_STATE.off_code) {
+ $interval.cancel(pollChassisStatusTimer);
+ pollChassisStatusTimer = undefined;
+ deferred.resolve(state);
+ }
+ }).catch(function(error) {
+ $interval.cancel(pollChassisStatusTimer);
+ pollChassisStatusTimer = undefined;
+ deferred.reject(error);
+ });
+ }, Constants.POLL_INTERVALS.POWER_OP);
+
+ return deferred.promise;
+ }
+
+ function pollHostStatusTillOn() {
+ var deferred = $q.defer();
+ pollHostStatusTimer = $interval(function() {
+ var now = new Date();
+ if ((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.HOST_ON) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_ON_TIMEOUT));
+ }
+ APIUtils.getHostState().then(function(state) {
+ setHostState(state);
+ if (state === Constants.HOST_STATE_TEXT.on_code) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.resolve(state);
+ }
+ else if (state === Constants.HOST_STATE_TEXT.error_code) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_QUIESCED));
+ }
+ }).catch(function(error) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.reject(error);
+ });
+ }, Constants.POLL_INTERVALS.POWER_OP);
- return deferred.promise;
- }
- function pollHostStatusTillOn(){
- var deferred = $q.defer();
- pollHostStatusTimer = $interval(function(){
- var now = new Date();
- if((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.HOST_ON){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_ON_TIMEOUT));
- }
- APIUtils.getHostState().then(function(state){
- setHostState(state);
- if(state === Constants.HOST_STATE_TEXT.on_code){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.resolve(state);
- }else if(state === Constants.HOST_STATE_TEXT.error_code){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_QUIESCED));
- }
- }).catch(function(error){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.reject(error);
- });
- }, Constants.POLL_INTERVALS.POWER_OP);
+ return deferred.promise;
+ }
- return deferred.promise;
- }
- function pollHostStatusTillOff(){
- var deferred = $q.defer();
- pollHostStatusTimer = $interval(function(){
- var now = new Date();
- if((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.HOST_OFF){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_OFF_TIMEOUT));
- }
- APIUtils.getHostState().then(function(state){
- setHostState(state);
- if(state === Constants.HOST_STATE_TEXT.off_code){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.resolve(state);
- }
- }).catch(function(error){
- $interval.cancel(pollHostStatusTimer);
- pollHostStatusTimer = undefined;
- deferred.reject(error);
- });
- }, Constants.POLL_INTERVALS.POWER_OP);
+ function pollHostStatusTillOff() {
+ var deferred = $q.defer();
+ pollHostStatusTimer = $interval(function() {
+ var now = new Date();
+ if ((now.getTime() - pollStartTime.getTime()) >= Constants.TIMEOUT.HOST_OFF) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.reject(new Error(Constants.MESSAGES.POLL.HOST_OFF_TIMEOUT));
+ }
+ APIUtils.getHostState().then(function(state) {
+ setHostState(state);
+ if (state === Constants.HOST_STATE_TEXT.off_code) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.resolve(state);
+ }
+ }).catch(function(error) {
+ $interval.cancel(pollHostStatusTimer);
+ pollHostStatusTimer = undefined;
+ deferred.reject(error);
+ });
+ }, Constants.POLL_INTERVALS.POWER_OP);
- return deferred.promise;
- }
- $scope.warmReboot = function(){
- $scope.loading = true;
- dataService.setUnreachableState();
- APIUtils.hostReboot().then(function(response){
- return response;
- }).then(function(lastStatus) {
- pollStartTime = new Date();
- return pollHostStatusTillOff();
- }).then(function(hostState) {
- pollStartTime = new Date();
- return pollHostStatusTillOn();
- }).then(function(hostState) {
- $scope.loading = false;
- }).catch(function(error){
- dataService.activateErrorModal(
- {title: Constants.MESSAGES.POWER_OP.WARM_REBOOT_FAILED,
- description: error.statusText ?
- $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)(
- {status: error.status, description: error.statusText}) :
- error });
- $scope.loading = false;
- });
- };
- $scope.testState = function(){
- $timeout(function(){
- dataService.setPowerOffState();
- $timeout(function(){
- dataService.setPowerOnState();
- }, 2000);
- }, 1000);
- };
- $scope.warmRebootConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- $scope.warmboot_confirm = true;
- };
+ return deferred.promise;
+ }
+ $scope.warmReboot = function() {
+ $scope.loading = true;
+ dataService.setUnreachableState();
+ APIUtils.hostReboot().then(function(response) {
+ return response;
+ }).then(function(lastStatus) {
+ pollStartTime = new Date();
+ return pollHostStatusTillOff();
+ }).then(function(hostState) {
+ pollStartTime = new Date();
+ return pollHostStatusTillOn();
+ }).then(function(hostState) {
+ $scope.loading = false;
+ }).catch(function(error) {
+ dataService.activateErrorModal({
+ title: Constants.MESSAGES.POWER_OP.WARM_REBOOT_FAILED,
+ description: error.statusText ?
+ $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)({
+ status: error.status,
+ description: error.statusText
+ }) : error
+ });
+ $scope.loading = false;
+ });
+ };
+ $scope.testState = function() {
+ $timeout(function() {
+ dataService.setPowerOffState();
+ $timeout(function() {
+ dataService.setPowerOnState();
+ }, 2000);
+ }, 1000);
+ };
+ $scope.warmRebootConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ $scope.warmboot_confirm = true;
+ };
- $scope.coldReboot = function(){
- $scope.loading = true;
- dataService.setUnreachableState();
- APIUtils.chassisPowerOff().then(function(state){
- return state;
- }).then(function(lastState) {
- pollStartTime = new Date();
- return pollChassisStatusTillOff();
- }).then(function(chassisState) {
- return APIUtils.hostPowerOn().then(function(hostState){
- return hostState;
- })
- }).then(function(hostState) {
- pollStartTime = new Date();
- return pollHostStatusTillOn();
- }).then(function(state) {
- $scope.loading = false;
- }).catch(function(error){
- dataService.activateErrorModal(
- {title: Constants.MESSAGES.POWER_OP.COLD_REBOOT_FAILED,
- description: error.statusText ?
- $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)(
- {status: error.status, description: error.statusText}) :
- error });
- $scope.loading = false;
- });
- };
- $scope.coldRebootConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- $scope.coldboot_confirm = true;
- };
+ $scope.coldReboot = function() {
+ $scope.loading = true;
+ dataService.setUnreachableState();
+ APIUtils.chassisPowerOff().then(function(state) {
+ return state;
+ }).then(function(lastState) {
+ pollStartTime = new Date();
+ return pollChassisStatusTillOff();
+ }).then(function(chassisState) {
+ return APIUtils.hostPowerOn().then(function(hostState) {
+ return hostState;
+ });
+ }).then(function(hostState) {
+ pollStartTime = new Date();
+ return pollHostStatusTillOn();
+ }).then(function(state) {
+ $scope.loading = false;
+ }).catch(function(error) {
+ dataService.activateErrorModal({
+ title: Constants.MESSAGES.POWER_OP.COLD_REBOOT_FAILED,
+ description: error.statusText ?
+ $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)({
+ status: error.status,
+ description: error.statusText
+ }) : error
+ });
+ $scope.loading = false;
+ });
+ };
+ $scope.coldRebootConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ $scope.coldboot_confirm = true;
+ };
- $scope.orderlyShutdown = function(){
- $scope.loading = true;
- dataService.setUnreachableState();
- APIUtils.hostPowerOff().then(function(response){
- return response;
- }).then(function(lastStatus) {
- pollStartTime = new Date();
- return pollHostStatusTillOff()
- }).then(function(hostState) {
- pollStartTime = new Date();
- return pollChassisStatusTillOff();
- }).then(function(chassisState) {
- $scope.loading = false;
- }).catch(function(error){
- dataService.activateErrorModal(
- {title: Constants.MESSAGES.POWER_OP.ORDERLY_SHUTDOWN_FAILED,
- description: error.statusText ?
- $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)(
- {status: error.status, description: error.statusText}) :
- error });
- $scope.loading = false;
- });
- };
- $scope.orderlyShutdownConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- $scope.orderly_confirm = true;
- };
+ $scope.orderlyShutdown = function() {
+ $scope.loading = true;
+ dataService.setUnreachableState();
+ APIUtils.hostPowerOff().then(function(response) {
+ return response;
+ }).then(function(lastStatus) {
+ pollStartTime = new Date();
+ return pollHostStatusTillOff();
+ }).then(function(hostState) {
+ pollStartTime = new Date();
+ return pollChassisStatusTillOff();
+ }).then(function(chassisState) {
+ $scope.loading = false;
+ }).catch(function(error) {
+ dataService.activateErrorModal({
+ title: Constants.MESSAGES.POWER_OP.ORDERLY_SHUTDOWN_FAILED,
+ description: error.statusText ?
+ $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)({
+ status: error.status,
+ description: error.statusText
+ }) : error
+ });
+ $scope.loading = false;
+ });
+ };
+ $scope.orderlyShutdownConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ $scope.orderly_confirm = true;
+ };
- $scope.immediateShutdown = function(){
- $scope.loading = true;
- dataService.setUnreachableState();
- APIUtils.chassisPowerOff().then(function(response){
- return response;
- }).then(function(lastStatus) {
- pollStartTime = new Date();
- return pollChassisStatusTillOff();
- }).then(function(chassisState) {
- dataService.setPowerOffState();
- $scope.loading = false;
- }).catch(function(error){
- dataService.activateErrorModal(
- {title: Constants.MESSAGES.POWER_OP.IMMEDIATE_SHUTDOWN_FAILED,
- description: error.statusText ?
- $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)(
- {status: error.status, description: error.statusText}) :
- error });
- $scope.loading = false;
- });
- };
- $scope.immediateShutdownConfirm = function(){
- if($scope.confirm) {
- return;
- }
- $scope.confirm = true;
- $scope.immediately_confirm = true;
- };
- }
- ]
- );
+ $scope.immediateShutdown = function() {
+ $scope.loading = true;
+ dataService.setUnreachableState();
+ APIUtils.chassisPowerOff().then(function(response) {
+ return response;
+ }).then(function(lastStatus) {
+ pollStartTime = new Date();
+ return pollChassisStatusTillOff();
+ }).then(function(chassisState) {
+ dataService.setPowerOffState();
+ $scope.loading = false;
+ }).catch(function(error) {
+ dataService.activateErrorModal({
+ title: Constants.MESSAGES.POWER_OP.IMMEDIATE_SHUTDOWN_FAILED,
+ description: error.statusText ?
+ $interpolate(Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)({
+ status: error.status,
+ description: error.statusText
+ }) : error
+ });
+ $scope.loading = false;
+ });
+ };
+ $scope.immediateShutdownConfirm = function() {
+ if ($scope.confirm) {
+ return;
+ }
+ $scope.confirm = true;
+ $scope.immediately_confirm = true;
+ };
+ }
+ ]);
})(angular);
diff --git a/app/server-control/controllers/remote-console-controller.js b/app/server-control/controllers/remote-console-controller.js
index ee6a591..c2e1435 100644
--- a/app/server-control/controllers/remote-console-controller.js
+++ b/app/server-control/controllers/remote-console-controller.js
@@ -6,72 +6,75 @@
* @name remoteConsoleController
*/
-import {hterm, lib} from 'hterm-umdjs';
+import {
+ hterm,
+ lib
+}
+from 'hterm-umdjs';
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.serverControl')
- .controller('remoteConsoleController', [
- '$scope',
- '$window',
- 'APIUtils',
- 'dataService',
- function($scope, $window, APIUtils, dataService){
- $scope.dataService = dataService;
+ angular
+ .module('app.serverControl')
+ .controller('remoteConsoleController', [
+ '$scope',
+ '$window',
+ 'APIUtils',
+ 'dataService',
+ function($scope, $window, APIUtils, dataService) {
+ $scope.dataService = dataService;
- // See https://github.com/macton/hterm for available hterm options
+ // See https://github.com/macton/hterm for available hterm options
- hterm.defaultStorage = new lib.Storage.Local();
- var term = new hterm.Terminal("host-console");
- term.decorate(document.querySelector('#terminal'));
- //Set cursor color
- term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
- //Set background color
- term.prefs_.set('background-color', '#19273c');
- //Allows keyboard input
- term.installKeyboard();
+ hterm.defaultStorage = new lib.Storage.Local();
+ var term = new hterm.Terminal('host-console');
+ term.decorate(document.querySelector('#terminal'));
+ //Set cursor color
+ term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
+ //Set background color
+ term.prefs_.set('background-color', '#19273c');
+ //Allows keyboard input
+ term.installKeyboard();
- //The BMC exposes a websocket at /console0. This can be read
- //or written to access the host serial console.
- var hostname = dataService.getHost().replace("https://", '');
- var host = "wss://" + hostname + "/console0";
- var ws = new WebSocket(host);
- ws.onmessage = function (evt) {
- //websocket -> terminal
- term.io.print(evt.data);
- };
+ //The BMC exposes a websocket at /console0. This can be read
+ //or written to access the host serial console.
+ var hostname = dataService.getHost().replace('https://', '');
+ var host = 'wss://' + hostname + '/console0';
+ var ws = new WebSocket(host);
+ ws.onmessage = function(evt) {
+ //websocket -> terminal
+ term.io.print(evt.data);
+ };
- //terminal -> websocket
- term.onTerminalReady = function() {
- var io = term.io.push();
- io.onVTKeystroke = function(str) {
- ws.send(str);
- };
- io.sendString = function(str) {
- ws.send(str);
- };
- };
+ //terminal -> websocket
+ term.onTerminalReady = function() {
+ var io = term.io.push();
+ io.onVTKeystroke = function(str) {
+ ws.send(str);
+ };
+ io.sendString = function(str) {
+ ws.send(str);
+ };
+ };
- ws.onopen = function() {
- console.log("websocket opened");
- };
- ws.onclose = function() {
- console.log("websocket closed");
- };
- $scope.$on("$destroy", function() {
- if(ws) {
- ws.close();
- }
- });
+ ws.onopen = function() {
+ console.log('websocket opened');
+ };
+ ws.onclose = function() {
+ console.log('websocket closed');
+ };
+ $scope.$on('$destroy', function() {
+ if (ws) {
+ ws.close();
+ }
+ });
- $scope.openTerminalWindow = function(){
- dataService.setRemoteWindowActive();
- $window.open('#/server-control/remote-console-window','Remote Console Window','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=400');
- }
- }
- ]
- );
+ $scope.openTerminalWindow = function() {
+ dataService.setRemoteWindowActive();
+ $window.open('#/server-control/remote-console-window', 'Remote Console Window', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=400');
+ };
+ }
+ ]);
})(angular);
diff --git a/app/server-control/controllers/remote-console-window-controller.js b/app/server-control/controllers/remote-console-window-controller.js
index d9a342f..685b45e 100644
--- a/app/server-control/controllers/remote-console-window-controller.js
+++ b/app/server-control/controllers/remote-console-window-controller.js
@@ -6,58 +6,57 @@
* @name remoteConsoleController
*/
-window.angular && (function (angular) {
- 'use strict';
-
- angular
- .module('app.serverControl')
- .controller('remoteConsoleWindowController', [
- '$scope',
- '$window',
- 'APIUtils',
- 'dataService',
- function($scope, $window, APIUtils, dataService){
- $scope.dataService = dataService;
- dataService.showNavigation = false;
-
- // See https://github.com/macton/hterm for available hterm options
-
- //Storage
- hterm.defaultStorage = new lib.Storage.Local();
-
- var term = new hterm.Terminal("foo");
- term.onTerminalReady = function() {
- var io = term.io.push();
- io.onVTKeystroke = function(str) {
- console.log(str)
- term.io.print(str);
- };
- io.sendString = function(str) {
- console.log(str)
- };
- };
- term.decorate(document.querySelector('#terminal'));
-
- //Set cursor color
- term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
-
- //Set background color
- term.prefs_.set('background-color', '#19273c');
-
- //Print to console window
- term.io.println('OpenBMC ver.00');
- term.io.println('This is not an actual live connection.');
- term.io.print('root@IBM:');
-
- //Allows keyboard input
- term.installKeyboard();
-
- $scope.close = function(){
- dataService.setRemoteWindowInactive();
- $window.close();
- }
- }
- ]
- );
+window.angular && (function(angular) {
+ 'use strict';
+
+ angular
+ .module('app.serverControl')
+ .controller('remoteConsoleWindowController', [
+ '$scope',
+ '$window',
+ 'APIUtils',
+ 'dataService',
+ function($scope, $window, APIUtils, dataService) {
+ $scope.dataService = dataService;
+ dataService.showNavigation = false;
+
+ // See https://github.com/macton/hterm for available hterm options
+
+ //Storage
+ hterm.defaultStorage = new lib.Storage.Local();
+
+ var term = new hterm.Terminal('foo');
+ term.onTerminalReady = function() {
+ var io = term.io.push();
+ io.onVTKeystroke = function(str) {
+ console.log(str);
+ term.io.print(str);
+ };
+ io.sendString = function(str) {
+ console.log(str);
+ };
+ };
+ term.decorate(document.querySelector('#terminal'));
+
+ //Set cursor color
+ term.prefs_.set('cursor-color', 'rgba(83, 146, 255, .5)');
+
+ //Set background color
+ term.prefs_.set('background-color', '#19273c');
+
+ //Print to console window
+ term.io.println('OpenBMC ver.00');
+ term.io.println('This is not an actual live connection.');
+ term.io.print('root@IBM:');
+
+ //Allows keyboard input
+ term.installKeyboard();
+
+ $scope.close = function() {
+ dataService.setRemoteWindowInactive();
+ $window.close();
+ };
+ }
+ ]);
})(angular);
diff --git a/app/server-control/index.js b/app/server-control/index.js
index 41cb1ac..12debcf 100644
--- a/app/server-control/index.js
+++ b/app/server-control/index.js
@@ -5,48 +5,48 @@
* @exports app/server-control/index
*/
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.serverControl', [
- 'ngRoute',
- 'app.constants',
- 'app.common.services'
- ])
- // Route configuration
- .config(['$routeProvider', function ($routeProvider) {
- $routeProvider
- .when('/server-control/bmc-reboot', {
- 'template': require('./controllers/bmc-reboot-controller.html'),
- 'controller': 'bmcRebootController',
- authenticated: true
- })
- .when('/server-control/server-led', {
- 'template': require('../server-health/controllers/unit-id-controller.html'),
- 'controller': 'unitIdController',
- authenticated: true
- })
- .when('/server-control/power-operations', {
- 'template': require('./controllers/power-operations-controller.html'),
- 'controller': 'powerOperationsController',
- authenticated: true
- })
- .when('/server-control/remote-console', {
- 'template': require('./controllers/remote-console-controller.html'),
- 'controller': 'remoteConsoleController',
- authenticated: true
- })
- .when('/server-control/remote-console-window', {
- 'template': require('./controllers/remote-console-window-controller.html'),
- 'controller': 'remoteConsoleWindowController',
- authenticated: true
- })
- .when('/server-control', {
- 'template': require('./controllers/power-operations-controller.html'),
- 'controller': 'powerOperationsController',
- authenticated: true
- });
- }]);
+ angular
+ .module('app.serverControl', [
+ 'ngRoute',
+ 'app.constants',
+ 'app.common.services'
+ ])
+ // Route configuration
+ .config(['$routeProvider', function($routeProvider) {
+ $routeProvider
+ .when('/server-control/bmc-reboot', {
+ 'template': require('./controllers/bmc-reboot-controller.html'),
+ 'controller': 'bmcRebootController',
+ authenticated: true
+ })
+ .when('/server-control/server-led', {
+ 'template': require('../server-health/controllers/unit-id-controller.html'),
+ 'controller': 'unitIdController',
+ authenticated: true
+ })
+ .when('/server-control/power-operations', {
+ 'template': require('./controllers/power-operations-controller.html'),
+ 'controller': 'powerOperationsController',
+ authenticated: true
+ })
+ .when('/server-control/remote-console', {
+ 'template': require('./controllers/remote-console-controller.html'),
+ 'controller': 'remoteConsoleController',
+ authenticated: true
+ })
+ .when('/server-control/remote-console-window', {
+ 'template': require('./controllers/remote-console-window-controller.html'),
+ 'controller': 'remoteConsoleWindowController',
+ authenticated: true
+ })
+ .when('/server-control', {
+ 'template': require('./controllers/power-operations-controller.html'),
+ 'controller': 'powerOperationsController',
+ authenticated: true
+ });
+ }]);
})(window.angular);
OpenPOWER on IntegriCloud