diff options
| author | Iftekharul Islam <iislam@us.ibm.com> | 2017-04-19 14:37:55 -0500 |
|---|---|---|
| committer | Patrick Williams <patrick@stwcx.xyz> | 2017-09-20 12:41:34 -0500 |
| commit | cd78950815d9b230f0eaa41a947fcae6d4cbbcb7 (patch) | |
| tree | 3bad52ea935ec87f7fd7da424f5b959f2e4c4c29 /app/server-control | |
| parent | 994a93b29ddbae647f2cb1aae6ec94e8a26db88c (diff) | |
| download | phosphor-webui-cd78950815d9b230f0eaa41a947fcae6d4cbbcb7.tar.gz phosphor-webui-cd78950815d9b230f0eaa41a947fcae6d4cbbcb7.zip | |
Change navigation structure
Change-Id: I12c819293ce1eda188dc9f257ae9370f1b73cb18
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
Diffstat (limited to 'app/server-control')
| -rw-r--r-- | app/server-control/controllers/bmc-reboot-controller.html | 27 | ||||
| -rw-r--r-- | app/server-control/controllers/bmc-reboot-controller.js | 40 | ||||
| -rw-r--r-- | app/server-control/controllers/power-operations-controller.html | 55 | ||||
| -rw-r--r-- | app/server-control/controllers/power-operations-controller.js | 134 | ||||
| -rw-r--r-- | app/server-control/controllers/remote-console-controller.html | 5 | ||||
| -rw-r--r-- | app/server-control/controllers/remote-console-controller.js | 26 | ||||
| -rw-r--r-- | app/server-control/index.js | 43 | ||||
| -rw-r--r-- | app/server-control/styles/bmc-reboot.scss | 27 | ||||
| -rw-r--r-- | app/server-control/styles/index.scss | 3 | ||||
| -rw-r--r-- | app/server-control/styles/power-operations.scss | 102 | ||||
| -rw-r--r-- | app/server-control/styles/remote-console.scss | 0 |
11 files changed, 462 insertions, 0 deletions
diff --git a/app/server-control/controllers/bmc-reboot-controller.html b/app/server-control/controllers/bmc-reboot-controller.html new file mode 100644 index 0000000..50fca7f --- /dev/null +++ b/app/server-control/controllers/bmc-reboot-controller.html @@ -0,0 +1,27 @@ +<div id="bmc-reboot"> + <div class="row column"> + <h1>Reboot BMC</h1> + </div> + + <div class="row column btm-border-grey"> + <span class="bmc-reboot__status-log inline">BMC last reboot at {{dataService.last_updated |date:'h:mm:ss on MM/dd/yyyy'}}</span> + </div> + + <div class="row column btm-border-grey bmc-reboot-option" + ng-class="{disabled: dataService.server_unreachable || dataService.loading, transitionAll: confirm}"> + <ul> + <li>Rebooting the BMC causes your browser to lose contact with the BMC for several minutes.</li> + <li>When the BMC software has started, you can then log in again.</li> + <li>If the Log In button is not enabled after several minutes, you may need to point your browser to the + BMC’s address and log in again. + </li> + </ul> + <button id="bmc__reboot" class="btn-secondary" ng-click="rebootConfirm()" ng-disabled="dataService.server_unreachable"><i>↻</i> Reboot BMC + </button> + <confirm title="Reboot the BMC" + message="Rebooting the BMC causes your browser to lose contact with the BMC for several minutes." + confirm="confirm" + ng-show="confirm" + callback="reboot"></confirm> + </div> +</div> diff --git a/app/server-control/controllers/bmc-reboot-controller.js b/app/server-control/controllers/bmc-reboot-controller.js new file mode 100644 index 0000000..a28c6ad --- /dev/null +++ b/app/server-control/controllers/bmc-reboot-controller.js @@ -0,0 +1,40 @@ +/** + * Controller for bmc-reboot + * + * @module app/serverControl + * @exports bmcRebootController + * @name bmcRebootController + * @version 0.1.0 + */ + +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.setBootingState(); + 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.html b/app/server-control/controllers/power-operations-controller.html new file mode 100644 index 0000000..79aa861 --- /dev/null +++ b/app/server-control/controllers/power-operations-controller.html @@ -0,0 +1,55 @@ +<div id="power-operations"> + + <div class="row column"> + <h1>Server power operation</h1> + </div> + + <!-- Current status and bar display the state of the server. Class 'power__state-off' is applied to bar and 'power__state' text switches to say "off"--> + <div class="row column"> + <div class="power__current-status "> + <h2 class="inline h4">Current status</h2> + <span class="power__status-log inline float-right">Server last reset at {{dataService.last_updated |date:'h:mm:ss on MM/dd/yyyy'}}</span> + </div> + </div> + <div class="row column"> + <div id="power-indicator-bar" class="power__indicator-bar" ng-class="{'power__state-on': dataService.server_state == 'Running', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet': dataService.server_state == 'Quiesced'}"> + <p class="inline">{{dataService.server_id}}</p> + <h3 class="power__state inline float-right h3"><span>{{dataService.server_state}}</span></h3> + </div> + </div> + <div class="row column"> + <div class="row column"> + <h3 class="h4">Select a power operation</h3> + </div> + + <!-- Power on displays only when server is shutdown --> + <div class="row column power-option" ng-hide="dataService.server_state == 'Running' || dataService.server_state == 'Quiesced'" ng-class="{disabled: dataService.server_unreachable || (confirm && !power_confirm) || dataService.loading, transitionAll: confirm && power_confirm}"> + <button id="power__power-on" class="btn-secondary" ng-click="togglePower()" role="button" ng-disabled="dataService.server_unreachable"><img src="assets/images/icon-power.svg">Power On</button> + <p>Attempts to power on the server</p> + + <!---<confirm title="power off" message="Power off the server" confirm="power_confirm" ng-show="power_confirm" callback="togglePower"></confirm>--> + </div> + + <!-- Power reboot/shutdown options : when server is off all of these are hidden. When one option is selected, the others are disabled. --> + <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: dataService.server_unreachable || (confirm && !warmboot_confirm) || dataService.loading, transitionAll: confirm && warmboot_confirm}"> + <button id="power__warm-boot" class="btn-secondary" ng-click="warmRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"><i>↻</i> Warm reboot</button> + <p>Attempts to perform an orderly shutdown before restarting the server</p> + <confirm title="Warm Reboot" message="perform an orderly shutdown" confirm="warmboot_confirm" ng-show="warmboot_confirm" callback="warmReboot"></confirm> + </div> + <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: dataService.server_unreachable || (confirm && !coldboot_confirm) || dataService.loading, transitionAll: confirm && coldboot_confirm}"> + <button id="power__cold-boot" class="btn-secondary" ng-click="coldRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"><i>↻</i> Cold reboot</button> + <p>Shuts down the server immediately, then restarts it</p> + <confirm title="Cold Reboot" message="Shutdown server immediately." confirm="coldboot_confirm" ng-show="coldboot_confirm" cancel="coldbootCancel" callback="coldReboot"></confirm> + </div> + <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: dataService.server_unreachable || (confirm && !orderly_confirm) || dataService.loading, transitionAll: confirm && orderly_confirm}"> + <button id="power__soft-shutdown" class="btn-secondary" ng-click="orderlyShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"><img src="assets/images/icon-power.svg" />Orderly shutdown</button> + <p>Attempts to stop all software on the server before removing power</p> + <confirm title="Orderly shutdown" message="Attempts to stop all software orderly." confirm="orderly_confirm" ng-show="orderly_confirm" cancel="orderlyShutdownCancel" callback="orderlyShutdown"></confirm> + </div> + <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: dataService.server_unreachable || (confirm && !immediately_confirm) || dataService.loading, transitionAll: confirm && immediately_confirm}"> + <button id="power__hard-shutdown" class="btn-secondary" ng-click="immediateShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"><img src="assets/images/icon-power.svg" />Immediate shutdown</button> + <p>Removes power from the server without waiting for software to stop</p> + <confirm title="Immediate shutdown" message="Removes power from the server immediately." confirm="immediately_confirm" ng-show="immediately_confirm" cancel="immediatelyShutdownCancel" callback="immediateShutdown"></confirm> + </div> + </div> +</div>
\ No newline at end of file diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js new file mode 100644 index 0000000..4e66f56 --- /dev/null +++ b/app/server-control/controllers/power-operations-controller.js @@ -0,0 +1,134 @@ +/** + * Controller for power-operations + * + * @module app/serverControl + * @exports powerOperationsController + * @name powerOperationsController + * @version 0.1.0 + */ + +window.angular && (function (angular) { + 'use strict'; + + angular + .module('app.serverControl') + .controller('powerOperationsController', [ + '$scope', + 'APIUtils', + 'dataService', + '$timeout', + function($scope, APIUtils, dataService, $timeout){ + $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; + + //@TODO: call api and get proper state + $scope.toggleState = function(){ + dataService.server_state = (dataService.server_state == 'Running') ? 'Off': 'Running'; + } + + $scope.togglePower = function(){ + var method = (dataService.server_state == 'Running') ? 'hostPowerOff' : 'hostPowerOn'; + //@TODO: show progress or set class orange + APIUtils[method](function(response){ + //update state based on response + //error case? + if(response == null){ + console.log("Failed request."); + }else{ + //@TODO::need to get the server status + if(dataService.server_state == 'Running'){ + dataService.setPowerOffState(); + }else{ + dataService.setPowerOnState(); + } + } + }); + } + $scope.powerOnConfirm = function(){ + if($scope.confirm) { + return; + } + $scope.confirm = true; + $scope.power_confirm = true; + }; + $scope.warmReboot = function(){ + //@TODO:show progress + dataService.setBootingState(); + APIUtils.hostPowerOff(function(response){ + if(response){ + APIUtils.hostPowerOn(function(response){ + if(response){ + dataService.setPowerOnState(); + }else{ + //@TODO:show error message + } + }); + }else{ + } + }); + }; + $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.warmReboot(); + }; + $scope.coldRebootConfirm = function(){ + if($scope.confirm) { + return; + } + $scope.confirm = true; + $scope.coldboot_confirm = true; + }; + + $scope.orderlyShutdown = function(){ + //@TODO:show progress + APIUtils.hostPowerOff(function(response){ + if(response){ + dataService.setPowerOffState(); + }else{ + //@TODO:hide progress & show error message + } + }); + }; + $scope.orderlyShutdownConfirm = function(){ + if($scope.confirm) { + return; + } + $scope.confirm = true; + $scope.orderly_confirm = true; + }; + + $scope.immediateShutdown = function(){ + $scope.orderlyShutdown(); + }; + $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.html b/app/server-control/controllers/remote-console-controller.html new file mode 100644 index 0000000..5b456d4 --- /dev/null +++ b/app/server-control/controllers/remote-console-controller.html @@ -0,0 +1,5 @@ +<div id="server-control-remote-console"> + <div class="row column"> + <h1>Remote Console</h1> + </div> +</div>
\ No newline at end of file diff --git a/app/server-control/controllers/remote-console-controller.js b/app/server-control/controllers/remote-console-controller.js new file mode 100644 index 0000000..2f3376e --- /dev/null +++ b/app/server-control/controllers/remote-console-controller.js @@ -0,0 +1,26 @@ +/** + * Controller for server + * + * @module app/serverControl + * @exports remoteConsoleController + * @name remoteConsoleController + * @version 0.1.0 + */ + +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); diff --git a/app/server-control/index.js b/app/server-control/index.js new file mode 100644 index 0000000..3df0666 --- /dev/null +++ b/app/server-control/index.js @@ -0,0 +1,43 @@ +/** + * A module for the serverControl + * + * @module app/server-control/index + * @exports app/server-control/index + * @version 0.0.1 + */ + +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', { + 'templateUrl': 'server-control/controllers/bmc-reboot-controller.html', + 'controller': 'bmcRebootController', + authenticated: true + }) + .when('/server-control/power-operations', { + 'templateUrl': 'server-control/controllers/power-operations-controller.html', + 'controller': 'powerOperationsController', + authenticated: true + }) + .when('/server-control/remote-console', { + 'templateUrl': 'server-control/controllers/remote-console-controller.html', + 'controller': 'remoteConsoleController', + authenticated: true + }) + .when('/server-control', { + 'templateUrl': 'server-control/controllers/power-operations-controller.html', + 'controller': 'powerOperationsController', + authenticated: true + }); + }]); + +})(window.angular); diff --git a/app/server-control/styles/bmc-reboot.scss b/app/server-control/styles/bmc-reboot.scss new file mode 100644 index 0000000..23d1167 --- /dev/null +++ b/app/server-control/styles/bmc-reboot.scss @@ -0,0 +1,27 @@ +// BMC Reboot + +#bmc-reboot { + ul { + margin: 0; + padding: 0; + margin-left: 1.3em; + } + .bmc-reboot__status-log { + color: $darkgrey; + font-weight: 500; + margin-top: 1em; + padding-bottom: .7em; + } + + .bmc-reboot-option { + position: relative; + overflow: hidden; + padding-top: 1.5em; + padding-left: 1.8em; + button { + margin-bottom: 1.5em; + margin-top: 1.5em; + } + } + +} diff --git a/app/server-control/styles/index.scss b/app/server-control/styles/index.scss new file mode 100644 index 0000000..dfb6b6e --- /dev/null +++ b/app/server-control/styles/index.scss @@ -0,0 +1,3 @@ +@import "./bmc-reboot.scss"; +@import "./power-operations.scss"; +@import "./remote-console.scss";
\ No newline at end of file diff --git a/app/server-control/styles/power-operations.scss b/app/server-control/styles/power-operations.scss new file mode 100644 index 0000000..3594ab4 --- /dev/null +++ b/app/server-control/styles/power-operations.scss @@ -0,0 +1,102 @@ +// Power Operations SCSS + +#power-operations { + + .h4 { + font-weight: bold; + } + + // Power op time stamp + .power__status-log { + color: $darkgrey; + font-weight:500; + } + + // Power Curernt status wrapper + .power__current-status { + border-bottom: 1px solid $lightbg__grey; + margin: 2.625em 0 1.2em 0; + .h4 { + padding: 0; + margin: 0 0 .5em 0; + } + } + + // Power state indicator on/off + .power__state { + font-weight: 700; + margin-top: -.3em; + span:before { + content: '\25CF'; + display: inline-block; + font-size: 1.8em; + color: $darkgrey; + margin-right: .1em; + vertical-align: middle; + transform: translateY(-4px); + @include slowTransition-all; + } + } + + // Power bar indicator + .power__indicator-bar { + font-weight: bold; + padding: 1.4em 3em 0; + margin-bottom: 3.750em; + background-size: 200% 100%; + background-image: linear-gradient(to right, $lightgrey 50%, $status-ok-light 50%); + background-position: 0; + transition: background-position 2s ease; + overflow: hidden; + p { + padding: 0; + margin: 0; + } + &.power__state-on { + background-position: -100%; + .power__state { + span:before { + color: $status-ok; + } + } + } + &.power__state-off { + background-position: 0; + color: $darkgrey; + .power__state { + span:before { + color: $darkgrey; + } + } + } + &.power__state-indet { + color: $darkgrey; + @include indeterminate-bar; + .power__state { + span:before { + color: $status-warn; + } + } + } + } + + // Power button options + .power-option { + border-top: 1px solid $lightgrey; + padding: 1.8em 0 1em 0; + position: relative; + overflow: hidden; + min-height: 1px; + min-width: 100%; + .btn-secondary { + margin-bottom: .5em; + @include mediaQuery(small) { + min-width: 300px; + } + } + @include mediaQuery(small){ + padding: 1.8em 0 1em 1.8em; + } + } + +} //end power-operations
\ No newline at end of file diff --git a/app/server-control/styles/remote-console.scss b/app/server-control/styles/remote-console.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/server-control/styles/remote-console.scss |

