Skip to content

Commit

Permalink
Display Power Supply Inventory from PowerSubsystem
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
HuyLeAnh committed Mar 20, 2024
1 parent 5c2f61a commit 59a732b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/store/modules/HardwareStatus/PowerSupplyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const PowerSupplyStore = {
setPowerSupply: (state, data) => {
state.powerSupplies = data.map((powerSupply) => {
const {
EfficiencyPercent,
EfficiencyRatings = [],
FirmwareVersion,
LocationIndicatorActive,
MemberId,
Id,
Manufacturer,
Model,
Name,
Expand All @@ -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,
Expand Down Expand Up @@ -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));
},
},
Expand Down

0 comments on commit 59a732b

Please sign in to comment.