Show asset name in the app header

Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: If5394604d6c91b3604eaadb33178376fe6da672c
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 218feb6..6e9bd96 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -29,6 +29,7 @@
 const GlobalStore = {
   namespaced: true,
   state: {
+    assetTag: null,
     bmcTime: null,
     hostStatus: 'unreachable',
     languagePreference: localStorage.getItem('storedLanguage') || 'en-US',
@@ -39,6 +40,7 @@
     isAuthorized: true,
   },
   getters: {
+    assetTag: (state) => state.assetTag,
     hostStatus: (state) => state.hostStatus,
     bmcTime: (state) => state.bmcTime,
     languagePreference: (state) => state.languagePreference,
@@ -47,6 +49,7 @@
     isAuthorized: (state) => state.isAuthorized,
   },
   mutations: {
+    setAssetTag: (state, assetTag) => (state.assetTag = assetTag),
     setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime),
     setHostStatus: (state, hostState) =>
       (state.hostStatus = hostStateMapper(hostState)),
@@ -75,16 +78,19 @@
     getHostStatus({ commit }) {
       api
         .get('/redfish/v1/Systems/system')
-        .then(({ data: { PowerState, Status: { State } = {} } } = {}) => {
-          if (State === 'Quiesced' || State === 'InTest') {
-            // OpenBMC's host state interface is mapped to 2 Redfish
-            // properties "Status""State" and "PowerState". Look first
-            // at State for certain cases.
-            commit('setHostStatus', State);
-          } else {
-            commit('setHostStatus', PowerState);
+        .then(
+          ({ data: { AssetTag, PowerState, Status: { State } = {} } } = {}) => {
+            commit('setAssetTag', AssetTag);
+            if (State === 'Quiesced' || State === 'InTest') {
+              // OpenBMC's host state interface is mapped to 2 Redfish
+              // properties "Status""State" and "PowerState". Look first
+              // at State for certain cases.
+              commit('setHostStatus', State);
+            } else {
+              commit('setHostStatus', PowerState);
+            }
           }
-        })
+        )
         .catch((error) => console.log(error));
     },
   },