Add Power Usage Page
Created a new page, "Manage Power Usage".
This page is under the "Server control" tab.
This new page currently just displays the power consumption.
Future commits will allow the user to set the power cap from
this page. One day, things like power consumption trending
data could also be on this page.
There was a blank unused controller which was for similar things,
removed it.
Tested: See the page and the consumption data. Uploaded screenshots
to openbmc/openbmc#3221
Change-Id: I9f97c58a086f34c1c1990c03d5e05b081619bd5c
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/directives/app-navigation.html b/app/common/directives/app-navigation.html
index 64481f7..8c8f88a 100644
--- a/app/common/directives/app-navigation.html
+++ b/app/common/directives/app-navigation.html
@@ -89,21 +89,23 @@
<li ng-class="{'active': (path == '/server-control' || path == '/server-control/power-operations')}">
<a href="#/server-control/power-operations" tabindex="9" ng-click="closeSubnav()">Server power operations</a>
</li>
+ <li ng-class="{'active': (path == '/server-control/power-usage')}">
+ <a href="#/server-control/power-usage" tabindex="10" ng-click="closeSubnav()">Manage power usage</a></li>
<li ng-class="{'active': (path == '/server-control/server-led')}">
- <a href="#/server-control/server-led" tabindex="10" ng-click="closeSubnav()">Server LED</a></li>
+ <a href="#/server-control/server-led" tabindex="11" ng-click="closeSubnav()">Server LED</a></li>
<li ng-class="{'active': (path == '/server-control/bmc-reboot')}">
- <a href="#/server-control/bmc-reboot" tabindex="11" ng-click="closeSubnav()">Reboot BMC</a></li>
+ <a href="#/server-control/bmc-reboot" tabindex="12" ng-click="closeSubnav()">Reboot BMC</a></li>
<li ng-class="{'active': (path == '/server-control/remote-console')}">
- <a href="#/server-control/remote-console" tabindex="12" ng-click="closeSubnav()">Serial over LAN console</a></li>
+ <a href="#/server-control/remote-console" tabindex="13" ng-click="closeSubnav()">Serial over LAN console</a></li>
</ul>
<ul class="nav__second-level btn-firmware" ng-style="navStyle" ng-class="{opened: (showSubMenu && firstLevel == 'configuration')}">
<li ng-class="{'active': (path == '/configuration' || path == '/configuration/network')}">
- <a href="#/configuration/network" tabindex="13" ng-click="closeSubnav()">Network settings</a></li>
+ <a href="#/configuration/network" tabindex="14" ng-click="closeSubnav()">Network settings</a></li>
<li ng-class="{'active': (path == '/configuration' || path == '/configuration/firmware')}">
- <a href="#/configuration/firmware" tabindex="14" ng-click="closeSubnav()">Firmware</a></li>
+ <a href="#/configuration/firmware" tabindex="15" ng-click="closeSubnav()">Firmware</a></li>
</ul>
<ul class="nav__second-level btn-users" ng-style="navStyle" ng-class="{opened: (showSubMenu && firstLevel == 'users')}">
<li ng-class="{'active': (path == '/users' || path == '/users/manage-accounts')}">
- <a href="#/users/manage-accounts" tabindex="15" ng-click="closeSubnav()">Manage user account</a></li>
+ <a href="#/users/manage-accounts" tabindex="16" ng-click="closeSubnav()">Manage user account</a></li>
</ul>
</nav>
diff --git a/app/index.js b/app/index.js
index e385ecd..4d9ed64 100644
--- a/app/index.js
+++ b/app/index.js
@@ -59,6 +59,7 @@
import server_control_index from './server-control/index.js';
import bmc_reboot_controller from './server-control/controllers/bmc-reboot-controller.js';
import power_operations_controller from './server-control/controllers/power-operations-controller.js';
+import power_usage_controller from './server-control/controllers/power-usage-controller.js';
import remote_console_controller from './server-control/controllers/remote-console-controller.js';
import remote_console_window_controller from './server-control/controllers/remote-console-window-controller.js';
import server_led_controller from './server-control/controllers/server-led-controller.js';
@@ -67,7 +68,6 @@
import inventory_controller from './server-health/controllers/inventory-controller.js';
import inventory_overview_controller from './server-health/controllers/inventory-overview-controller.js';
import log_controller from './server-health/controllers/log-controller.js';
-import power_consumption_controller from './server-health/controllers/power-consumption-controller.js';
import sensors_controller from './server-health/controllers/sensors-controller.js';
import sensors_overview_controller from './server-health/controllers/sensors-overview-controller.js';
diff --git a/app/server-control/controllers/power-usage-controller.html b/app/server-control/controllers/power-usage-controller.html
new file mode 100644
index 0000000..c35ea93
--- /dev/null
+++ b/app/server-control/controllers/power-usage-controller.html
@@ -0,0 +1,22 @@
+<loader loading="loading"></loader>
+<div id="power-usage">
+ <div class="row power__usage-metadata">
+ <div class="row column">
+ <h1>Manage Power Usage</h1>
+ </div>
+ <div class="page-header">
+ <h2 class="bold h4">Power information</h2>
+ </div>
+ <fieldset>
+ <div class="column large-8">
+ <ul class="power__usage-metadata-wrapper">
+ <li class="power__usage-metadata-block">
+ <p class="content-label">Power Consumption</p>
+ <p class="courier-bold">{{power_consumption}}</p>
+ </li>
+ </ul>
+ </div>
+ </fieldset>
+ </div>
+</div>
+
diff --git a/app/server-control/controllers/power-usage-controller.js b/app/server-control/controllers/power-usage-controller.js
new file mode 100644
index 0000000..5ba8bf0
--- /dev/null
+++ b/app/server-control/controllers/power-usage-controller.js
@@ -0,0 +1,41 @@
+/**
+ * Controller for power-usage
+ *
+ * @module app/serverControl
+ * @exports powerUsageController
+ * @name powerUsageController
+ */
+
+window.angular && (function(angular) {
+ 'use strict';
+
+ angular.module('app.serverControl').controller('powerUsageController', [
+ '$scope', '$window', 'APIUtils', 'dataService', '$q',
+ function($scope, $window, APIUtils, dataService, $q) {
+ $scope.dataService = dataService;
+ $scope.power_consumption = '';
+ $scope.loading = false;
+ loadPowerData();
+
+ function loadPowerData() {
+ $scope.loading = true;
+ var getPowerConsumptionPromise = APIUtils.getPowerConsumption().then(
+ function(data) {
+ $scope.power_consumption = data;
+ },
+ function(error) {
+ console.log(JSON.stringify(error));
+ });
+
+ var promises = [
+ getPowerConsumptionPromise,
+ ];
+
+ $q.all(promises).finally(function() {
+ $scope.loading = false;
+ });
+ }
+ }
+ ]);
+
+})(angular);
diff --git a/app/server-control/index.js b/app/server-control/index.js
index 3b3600f..1e6eaf1 100644
--- a/app/server-control/index.js
+++ b/app/server-control/index.js
@@ -31,6 +31,12 @@
'controller': 'powerOperationsController',
authenticated: true
})
+ .when('/server-control/power-usage', {
+ 'template':
+ require('./controllers/power-usage-controller.html'),
+ 'controller': 'powerUsageController',
+ authenticated: true
+ })
.when('/server-control/remote-console', {
'template':
require('./controllers/remote-console-controller.html'),
diff --git a/app/server-control/styles/index.scss b/app/server-control/styles/index.scss
index cc69a87..f6b15ab 100644
--- a/app/server-control/styles/index.scss
+++ b/app/server-control/styles/index.scss
@@ -2,3 +2,4 @@
@import "./power-operations.scss";
@import "./remote-console.scss";
@import "./server-led.scss";
+@import "./power-usage.scss";
diff --git a/app/server-control/styles/power-usage.scss b/app/server-control/styles/power-usage.scss
new file mode 100644
index 0000000..4c956e2
--- /dev/null
+++ b/app/server-control/styles/power-usage.scss
@@ -0,0 +1,25 @@
+// Power Usage SCSS
+
+.power__usage-metadata {
+ border-bottom: 1px solid $medgrey;
+ padding: 1.8em 0 0 0;
+}
+
+.power__usage-metadata-wrapper {
+ margin: 0;
+ padding: 0;
+}
+
+.power__usage-metadata-block {
+ list-style-type: none;
+ min-width: 47%;
+ margin-bottom: 1.8em;
+ margin-right: .7em;
+ display: inline-block;
+ white-space: normal;
+ word-break: break-all;
+ @include mediaQuery(small) {
+ float: left;
+ }
+}
+
diff --git a/app/server-health/controllers/power-consumption-controller.html b/app/server-health/controllers/power-consumption-controller.html
deleted file mode 100644
index 7dfdf89..0000000
--- a/app/server-health/controllers/power-consumption-controller.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<div id="power-consumption">
- <div class="row column">
- <h1>Power consumption</h1>
- </div>
-</div>
\ No newline at end of file
diff --git a/app/server-health/controllers/power-consumption-controller.js b/app/server-health/controllers/power-consumption-controller.js
deleted file mode 100644
index 51882e4..0000000
--- a/app/server-health/controllers/power-consumption-controller.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Controller for server
- *
- * @module app/serverHealth
- * @exports powerConsumptionController
- * @name powerConsumptionController
- */
-
-window.angular && (function(angular) {
- 'use strict';
-
- angular.module('app.serverHealth').controller('powerConsumptionController', [
- '$scope', '$window', 'APIUtils', 'dataService',
- function($scope, $window, APIUtils, dataService) {
- $scope.dataService = dataService;
- }
- ]);
-
-})(angular);
diff --git a/app/server-health/index.js b/app/server-health/index.js
index e5eb9be..461e0bd 100644
--- a/app/server-health/index.js
+++ b/app/server-health/index.js
@@ -52,12 +52,6 @@
'controller': 'sensorsController',
authenticated: true
})
- .when('/server-health/power-consumption', {
- 'template':
- require('./controllers/power-consumption-controller.html'),
- 'controller': 'powerConsumptionController',
- authenticated: true
- })
.when('/server-health', {
'template': require('./controllers/log-controller.html'),
'controller': 'logController',
diff --git a/app/server-health/styles/index.scss b/app/server-health/styles/index.scss
index eeaabb2..009e991 100644
--- a/app/server-health/styles/index.scss
+++ b/app/server-health/styles/index.scss
@@ -1,4 +1,3 @@
@import "./inventory.scss";
@import "./log.scss";
@import "./sensors.scss";
-@import "./power-consumption.scss";
diff --git a/app/server-health/styles/power-consumption.scss b/app/server-health/styles/power-consumption.scss
deleted file mode 100644
index e69de29..0000000
--- a/app/server-health/styles/power-consumption.scss
+++ /dev/null