summaryrefslogtreecommitdiff
path: root/src/store/modules/Health/ChassisStore.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-06-08 17:36:59 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-06-18 00:15:19 +0300
commit09e8b5d478f212c094b7bea66c570fe0e673756e (patch)
treeffce5be1056608e82fe256e73dfb42c5e29911ab /src/store/modules/Health/ChassisStore.js
parentb89a53c8d4a740c959b12938445917c3df5d3d4b (diff)
downloadwebui-vue-09e8b5d478f212c094b7bea66c570fe0e673756e.tar.xz
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
Diffstat (limited to 'src/store/modules/Health/ChassisStore.js')
-rw-r--r--src/store/modules/Health/ChassisStore.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/store/modules/Health/ChassisStore.js b/src/store/modules/Health/ChassisStore.js
new file mode 100644
index 00000000..e9e58e72
--- /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;