Have loader wait for Last Power Operation

The loader (blue spinning half circle) should wait for the call
to get the Last Power Operation Time.

Change-Id: I105a5742244fb417cd3ab609e2c14771c28792cb
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js
index 0b2fb58..e36b61d 100644
--- a/app/server-control/controllers/power-operations-controller.js
+++ b/app/server-control/controllers/power-operations-controller.js
@@ -22,7 +22,7 @@
       $scope.coldboot_confirm = false;
       $scope.orderly_confirm = false;
       $scope.immediately_confirm = false;
-      $scope.loading = false;
+      $scope.loading = true;
 
       var pollChassisStatusTimer = undefined;
       var pollHostStatusTimer = undefined;
@@ -30,17 +30,22 @@
 
       //@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));
+      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));
+              })
+          .finally(function() {
+            $scope.loading = false;
           });
+
       $scope.toggleState = function() {
         dataService.server_state =
             (dataService.server_state == 'Running') ? 'Off' : 'Running';