diff options
author | beccabroek <rebecca.shaw@ibm.com> | 2018-08-03 11:25:11 -0500 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2018-08-11 00:37:10 +0000 |
commit | 5674425b5102eb306572ee5c55156348feaf26f7 (patch) | |
tree | cb1a82ea06e39f9be84543ea089921c67ca4b991 /app/server-control | |
parent | bc3ab72caefc75cf9a7fc37218a7b377ee349f3c (diff) | |
download | phosphor-webui-5674425b5102eb306572ee5c55156348feaf26f7.tar.gz phosphor-webui-5674425b5102eb306572ee5c55156348feaf26f7.zip |
Last power operation
Displays correct power operation time. In the case
that there has not been a power operation, 'not
available' is displayed.
Resolves openbmc/openbmc#2957
Tested: The GUI displayed 'not available' when it
received a 0 value and the correct date when an
epoch was recieved.
Signed-off-by: beccabroek <rebecca.shaw@ibm.com>
Change-Id: I9573a1cdcd31ba4c02888bd46d195c91fdb916a7
Diffstat (limited to 'app/server-control')
-rw-r--r-- | app/server-control/controllers/power-operations-controller.html | 6 | ||||
-rw-r--r-- | app/server-control/controllers/power-operations-controller.js | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/app/server-control/controllers/power-operations-controller.html b/app/server-control/controllers/power-operations-controller.html index dae0c67..5587ecd 100644 --- a/app/server-control/controllers/power-operations-controller.html +++ b/app/server-control/controllers/power-operations-controller.html @@ -4,11 +4,7 @@ <h1>Server power operations</h1> <div class="power__current-status page-header"> <h2 class="inline h4">Current status</h2> - <!-- TODO: openbmc/openbmc#2957 display correct last power - operation time, need REST call. - - <div class="power__status-log inline float-right">Last power operation at <span class="courier-bold">{{dataService.last_updated |date:'h:mm:ss on MMM dd yyyy'}}</span></div> - --> + <div class="power__status-log inline float-right">Last power operation at <span class="courier-bold">{{power_time | date:'medium'}}</span></div> </div> </div> <div class="row column"> diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js index f3955e6..0b2fb58 100644 --- a/app/server-control/controllers/power-operations-controller.js +++ b/app/server-control/controllers/power-operations-controller.js @@ -29,6 +29,18 @@ window.angular && (function(angular) { var pollStartTime = null; //@TODO: call api and get proper state + + APIUtils.getLastPowerTime().then( + function(data) { + if (data.data == 0) { + $scope.power_time = 'not available'; + } else { + $scope.power_time = data.data; + } + }, + function(error) { + console.log(JSON.stringify(error)); + }); $scope.toggleState = function() { dataService.server_state = (dataService.server_state == 'Running') ? 'Off' : 'Running'; @@ -321,5 +333,4 @@ window.angular && (function(angular) { }; } ]); - })(angular); |