From 59a732bc502740ee5d7ea37298a9576fb4131858 Mon Sep 17 00:00:00 2001 From: HuyLe Date: Mon, 9 Oct 2023 13:58:33 +0700 Subject: 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 --- .../modules/HardwareStatus/PowerSupplyStore.js | 24 ++++++++++++++++------ 1 file 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)); }, }, -- cgit v1.2.3