diff options
author | HuyLe <hule@amperecomputing.com> | 2023-10-09 09:58:33 +0300 |
---|---|---|
committer | HuyLe <hule@amperecomputing.com> | 2024-03-20 05:50:50 +0300 |
commit | 59a732bc502740ee5d7ea37298a9576fb4131858 (patch) | |
tree | 8eff4f6c057b5a87c1d3caf607e81adce987f92b | |
parent | 5c2f61a545b2460ce7eee4105e9c79c91de41da8 (diff) | |
download | webui-vue-59a732bc502740ee5d7ea37298a9576fb4131858.tar.xz |
Display Power Supply Inventory from PowerSubsystem
Switch Power Supply information to use information from the new
PowerSubsystem since bmcweb enabled this by default, any other modern
Redfish implementation should have this schema enabled.
Tested: On Ampere MtJade platform
1. Login to WebUI; Hardware Status; Inventory
2. Inventory information for power supplies is displayed.
Change-Id: Iad59d0145b47bcd5eb3cb4ff852e50da976a6005
Signed-off-by: HuyLe <hule@amperecomputing.com>
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index 82b71746..2393ba0a 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -12,10 +12,10 @@ const PowerSupplyStore = { setPowerSupply: (state, data) => { state.powerSupplies = data.map((powerSupply) => { const { - EfficiencyPercent, + EfficiencyRatings = [], FirmwareVersion, LocationIndicatorActive, - MemberId, + Id, Manufacturer, Model, Name, @@ -27,11 +27,11 @@ const PowerSupplyStore = { Status = {}, } = powerSupply; return { - id: MemberId, + id: Id, health: Status.Health, partNumber: PartNumber, serialNumber: SerialNumber, - efficiencyPercent: EfficiencyPercent, + efficiencyPercent: EfficiencyRatings[0].EfficiencyPercent, firmwareVersion: FirmwareVersion, identifyLed: LocationIndicatorActive, manufacturer: Manufacturer, @@ -70,8 +70,20 @@ const PowerSupplyStore = { }, async getChassisPower(_, id) { return await api - .get(`${id}/Power`) - .then(({ data: { PowerSupplies } }) => PowerSupplies || []) + .get(`${id}/PowerSubsystem`) + .then((response) => { + return api.get(`${response.data.PowerSupplies['@odata.id']}`); + }) + .then(({ data: { Members } }) => { + const promises = Members.map((member) => + api.get(member['@odata.id']), + ); + return api.all(promises); + }) + .then((response) => { + const data = response.map(({ data }) => data); + return data; + }) .catch((error) => console.log(error)); }, }, |