summaryrefslogtreecommitdiffstats
path: root/app/server-control/controllers
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-07-11 16:10:56 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-07-13 19:06:21 +0000
commit4b1f24c7d9abf9a4ed4c14eec68029e48212ce11 (patch)
treed82ab9dbbe01f0d33537fa3aa52cfd513a770fcc /app/server-control/controllers
parent9863d121ffe088c38538c7aef86b6773bbbee57a (diff)
downloadphosphor-webui-4b1f24c7d9abf9a4ed4c14eec68029e48212ce11.tar.gz
phosphor-webui-4b1f24c7d9abf9a4ed4c14eec68029e48212ce11.zip
Move server LED files
The WebUI has a main menu with 5 options: Server overview, Server health, Server control, Server Configuration, Users. These 5 main menu items each have a directory in /app/, although the directory names differ slightly. These 5 main menu items are also modules whose content includes their sub-menu items (again names differ slightly). E.g. "Firmware" and "Network settings" are sub-menu items of the main menu item "Server configuration" which is located in the app/configuration dir and part of the app.configuration module. The Server LED sub menu item did not follow this pattern and was under the wrong directory and in the wrong module. Moved it. In a future commit I renamed it from unit-id. Tested: Verified server LED still works. Change-Id: I02e3a7995cf8ccc5b487c345866651d984c8d70c Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'app/server-control/controllers')
-rw-r--r--app/server-control/controllers/unit-id-controller.html28
-rw-r--r--app/server-control/controllers/unit-id-controller.js43
2 files changed, 71 insertions, 0 deletions
diff --git a/app/server-control/controllers/unit-id-controller.html b/app/server-control/controllers/unit-id-controller.html
new file mode 100644
index 0000000..bc9c345
--- /dev/null
+++ b/app/server-control/controllers/unit-id-controller.html
@@ -0,0 +1,28 @@
+<div id="uid-switch">
+ <div class="row column">
+ <h1>Server LED</h1>
+ <div class="page-header">
+ <h2 class="h4">LED light control</h2>
+ </div>
+ </div>
+
+ <div class="row column" ng-class="{disabled: dataService.server_unreachable || dataService.loading}">
+ <div class="btm-border-grey">
+ <div class="toggle inline">
+ <input id="toggle__switch-round"
+ class="toggle-switch toggle-switch__round-flat"
+ type="checkbox"
+ tabindex="0"
+ ng-click="toggleLED()"
+ ng-checked="dataService.LED_state == 'on'"
+ ng-disabled="dataService.server_unreachable"
+ >
+ <label for="toggle__switch-round" tabindex="0">Server indicator is <span class="uid-switch__status">{{dataService.LED_state}}</span></label>
+ </div>
+ <div class="uid-switch__label inline">
+ <p>Server LED light is <span class="uid-switch__status">{{dataService.LED_state}}</span></p>
+ <p>Turn the LED light on or off. If the server has an LCD, use this control to display text (on) or not to display text (off) on the LCD.</p>
+ </div>
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/server-control/controllers/unit-id-controller.js b/app/server-control/controllers/unit-id-controller.js
new file mode 100644
index 0000000..3648acd
--- /dev/null
+++ b/app/server-control/controllers/unit-id-controller.js
@@ -0,0 +1,43 @@
+/**
+ * Controller for unit Id
+ *
+ * @module app/serverControl
+ * @exports unitIdController
+ * @name unitIdController
+ */
+
+window.angular && (function(angular) {
+ 'use strict';
+
+ angular.module('app.serverControl').controller('unitIdController', [
+ '$scope', '$window', 'APIUtils', 'dataService',
+ function($scope, $window, APIUtils, dataService) {
+ $scope.dataService = dataService;
+
+ APIUtils.getLEDState().then(function(state) {
+ $scope.displayLEDState(state);
+ });
+
+ $scope.displayLEDState = function(state) {
+ if (state == APIUtils.LED_STATE.on) {
+ dataService.LED_state = APIUtils.LED_STATE_TEXT.on;
+ } else {
+ dataService.LED_state = APIUtils.LED_STATE_TEXT.off;
+ }
+ };
+
+ $scope.toggleLED = function() {
+ var toggleState =
+ (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
+ APIUtils.LED_STATE.off :
+ APIUtils.LED_STATE.on;
+ dataService.LED_state =
+ (dataService.LED_state == APIUtils.LED_STATE_TEXT.on) ?
+ APIUtils.LED_STATE_TEXT.off :
+ APIUtils.LED_STATE_TEXT.on;
+ APIUtils.setLEDState(toggleState, function(status) {});
+ };
+ }
+ ]);
+
+})(angular);
OpenPOWER on IntegriCloud