summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index fca1f326..3f172d2d 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -38,10 +38,30 @@ const FanStore = {
},
},
actions: {
- async getFanInfo({ commit }) {
+ async getChassisCollection() {
return await api
- .get('/redfish/v1/Chassis/chassis/Thermal')
- .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans))
+ .get('/redfish/v1/Chassis')
+ .then(({ data: { Members } }) =>
+ api.all(
+ Members.map((member) =>
+ api.get(member['@odata.id']).then((response) => response.data)
+ )
+ )
+ )
+ .catch((error) => console.log(error));
+ },
+ async getFanInfo({ dispatch, commit }) {
+ const collection = await dispatch('getChassisCollection');
+ if (!collection || collection.length === 0) return;
+ return await api
+ .all(collection.map((chassis) => dispatch('getChassisFans', chassis)))
+ .then((fansFromChassis) => commit('setFanInfo', fansFromChassis.flat()))
+ .catch((error) => console.log(error));
+ },
+ async getChassisFans(_, chassis) {
+ return await api
+ .get(chassis.Thermal['@odata.id'])
+ .then(({ data: { Fans } }) => Fans || [])
.catch((error) => console.log(error));
},
},