diff options
author | MichalX Szopinski <michalx.szopinski@intel.com> | 2021-05-07 14:14:50 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2021-06-09 14:58:34 +0300 |
commit | dca9b0a5baddfec7ea0ea5e4bdb63c2dd0be27b2 (patch) | |
tree | 6fc55a19c0a6fc032068e9519af19c4f074a92b1 /src/store | |
parent | c2f8f34e19ef7b9987538e8c2624e629b5203c17 (diff) | |
download | webui-vue-dca9b0a5baddfec7ea0ea5e4bdb63c2dd0be27b2.tar.xz |
Remove hardcoded chassis in power supplies
According to our conversation on community meeting we want to remove all hardcoded chassis names in request URL. This change corrects the "Power supplies" table in "Hardware Status" view.
Signed-off-by: MichalX Szopinski <michalx.szopinski@intel.com>
Change-Id: I5219c68b71477adee5f6785c58808eeaa5d35986
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/Health/PowerSupplyStore.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/store/modules/Health/PowerSupplyStore.js b/src/store/modules/Health/PowerSupplyStore.js index 565715fa..cc82f2ef 100644 --- a/src/store/modules/Health/PowerSupplyStore.js +++ b/src/store/modules/Health/PowerSupplyStore.js @@ -38,14 +38,34 @@ const PowerSupplyStore = { }, }, actions: { - async getPowerSupply({ commit }) { + async getChassisCollection() { return await api - .get('/redfish/v1/Chassis/chassis/Power') - .then(({ data: { PowerSupplies } }) => - commit('setPowerSupply', PowerSupplies) + .get('/redfish/v1/Chassis') + .then(({ data: { Members } }) => + Members.map((member) => member['@odata.id']) ) .catch((error) => console.log(error)); }, + async getAllPowerSupplies({ dispatch, commit }) { + const collection = await dispatch('getChassisCollection'); + if (!collection) return; + return await api + .all(collection.map((chassis) => dispatch('getChassisPower', chassis))) + .then((supplies) => { + let suppliesList = []; + supplies.forEach( + (supply) => (suppliesList = [...suppliesList, ...supply]) + ); + commit('setPowerSupply', suppliesList); + }) + .catch((error) => console.log(error)); + }, + async getChassisPower(_, id) { + return await api + .get(`${id}/Power`) + .then(({ data: { PowerSupplies } }) => PowerSupplies || []) + .catch((error) => console.log(error)); + }, }, }; |