Add Chassis table to hardware status page

Add each chassis at /redfish/v1/Chassis endpoint to a table
with an expansion row to view property details.

Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I8d4c64fecac3857e0d4ece9fad81d9035e236c92
diff --git a/src/store/index.js b/src/store/index.js
index c4c0948..0f92175 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -18,6 +18,7 @@
 import PowerSupplyStore from './modules/Health/PowerSupplyStore';
 import MemoryStore from './modules/Health/MemoryStore';
 import FanStore from './modules/Health/FanStore';
+import ChassisStore from './modules/Health/ChassisStore';
 
 import WebSocketPlugin from './plugins/WebSocketPlugin';
 
@@ -44,7 +45,8 @@
     serverLed: ServerLedStore,
     system: SystemStore,
     memory: MemoryStore,
-    fan: FanStore
+    fan: FanStore,
+    chassis: ChassisStore
   },
   plugins: [WebSocketPlugin]
 });
diff --git a/src/store/modules/Health/ChassisStore.js b/src/store/modules/Health/ChassisStore.js
new file mode 100644
index 0000000..e9e58e7
--- /dev/null
+++ b/src/store/modules/Health/ChassisStore.js
@@ -0,0 +1,55 @@
+import api from '@/store/api';
+
+const ChassisStore = {
+  namespaced: true,
+  state: {
+    chassis: []
+  },
+  getters: {
+    chassis: state => state.chassis
+  },
+  mutations: {
+    setChassisInfo: (state, data) => {
+      state.chassis = data.map(chassis => {
+        const {
+          Id,
+          Status = {},
+          PartNumber,
+          SerialNumber,
+          ChassisType,
+          Manufacturer,
+          PowerState
+        } = chassis;
+
+        return {
+          id: Id,
+          health: Status.Health,
+          partNumber: PartNumber,
+          serialNumber: SerialNumber,
+          chassisType: ChassisType,
+          manufacturer: Manufacturer,
+          powerState: PowerState,
+          statusState: Status.State,
+          healthRollup: Status.HealthRollup
+        };
+      });
+    }
+  },
+  actions: {
+    async getChassisInfo({ commit }) {
+      return await api
+        .get('/redfish/v1/Chassis')
+        .then(({ data: { Members = [] } }) =>
+          Members.map(member => api.get(member['@odata.id']))
+        )
+        .then(promises => api.all(promises))
+        .then(response => {
+          const data = response.map(({ data }) => data);
+          commit('setChassisInfo', data);
+        })
+        .catch(error => console.log(error));
+    }
+  }
+};
+
+export default ChassisStore;