summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichalX Szopinski <michalx.szopinski@intel.com>2022-02-25 15:13:27 +0300
committerJason Bills <jason.m.bills@linux.intel.com>2023-04-20 23:11:02 +0300
commit6c5418f599c6cd87941331a970c03f68eec66c39 (patch)
treeae976c8b4459a31d688e4f8a09792a3d6978c852
parent6b424f998068f2336d0f2c0d8b806124554855e8 (diff)
downloadwebui-vue-6c5418f599c6cd87941331a970c03f68eec66c39.tar.xz
Remove hardcoded chassis from Fan store
This change removes the hardcoded chassis URL from FanStore. Now the URL is taken from the odata.id. Signed-off-by: MichalX Szopinski <michalx.szopinski@intel.com> Change-Id: I59e4d46a8aaa453f6662f4f396f32d7fad18fb91
-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));
},
},