diff options
-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)); }, }, |