Add fixes for power operations

Fixes applies to 'Power on', 'Warm reboot', 'Orderly shutdown',
and 'Immediate shutdown' power operations. Fixes include:

- Verifying that the chassis and host transition through the
  expected states for each power operation. During which time
  a spinner will be displayed. A timeout of 5 minutes for each
  state transition has been added.
- Displaying the current state of the host in the 'Server power'
  and 'Current status' bar.  The state displayed will change as
  the host transition through different states even as the
  spinner continues to spin.
- Displaying an error pop-up with reason for failure when the
  power operation fails.

Resolves openbmc/openbmc#2758
Resolves openbmc/openbmc#2787
Resolves openbmc/openbmc#2803

Change-Id: I514e030f9df7bd4d8b53634408f0449cd9abada9
Signed-off-by: CamVan Nguyen <ctnguyen@us.ibm.com>
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index 57c5eb1..3afd9ae 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -36,13 +36,14 @@
                     on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
                     off: 'Off',
                     off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
-                    booting: 'Quiesced',
+                    error: 'Quiesced',
+                    error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
                     unreachable: 'Unreachable'
                 },
                 HOST_STATE: {
                     on: 1,
                     off: -1,
-                    booting: 0,
+                    error: 0,
                     unreachable: -2
                 },
                 LED_STATE: {
@@ -122,10 +123,21 @@
                     ACTIVATION: 1000 * 60 * 10, // 10 mins
                     CHASSIS_OFF: 1000 * 60 * 5, // 5 mins
                     HOST_ON: 1000 * 60 * 5, // 5 mins
+                    HOST_OFF: 1000 * 60 * 5, // 5 mins
                 },
                 MESSAGES: {
                     POLL: {
-                        TIMEOUT: 'Time out. Did not reach power state in allotted time.',
+                        CHASSIS_OFF_TIMEOUT: 'Time out. Chassis did not reach power off state in allotted time.',
+                        HOST_ON_TIMEOUT: 'Time out. System did not reach Running state in allotted time.',
+                        HOST_OFF_TIMEOUT: 'Time out. System did not reach Off state in allotted time.',
+                        HOST_QUIESCED: 'System is in Error state.',
+                    },
+                    POWER_OP: {
+                        POWER_ON_FAILED: 'Power On Failed',
+                        WARM_REBOOT_FAILED: 'Warm Reboot Failed',
+                        COLD_REBOOT_FAILED: 'Cold Reboot Failed',
+                        ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed',
+                        IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed',
                     },
                     SENSOR: {
                         NO_SENSOR_DATA: 'There are no sensors found.',
@@ -136,7 +148,8 @@
                     ERROR_MODAL: {
                         TITLE: 'Unexpected error',
                         DESCRIPTION: 'Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.'
-                    }
+                    },
+                    ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
                 },
                 POWER_CAP_TEXT: {
                     unit: 'W',
diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js
index d84821a..6cf62ee 100644
--- a/app/common/services/dataService.js
+++ b/app/common/services/dataService.js
@@ -86,9 +86,9 @@
                 this.server_status = Constants.HOST_STATE.off;
             }
 
-            this.setBootingState = function(){
-                this.server_state = Constants.HOST_STATE_TEXT.booting;
-                this.server_status = Constants.HOST_STATE.booting;
+            this.setErrorState = function(){
+                this.server_state = Constants.HOST_STATE_TEXT.error;
+                this.server_status = Constants.HOST_STATE.error;
             }
 
             this.setUnreachableState = function(){