diff options
Diffstat (limited to 'src/store/modules/HardwareStatus')
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index dc7691da..775e86e8 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -3,10 +3,26 @@ import api from '@/store/api'; const PowerSupplyStore = { namespaced: true, state: { + psuTemp: [], + psuTempLastHour: [], + psuPower: [], + psuPowerLastHour: [], + psuVoltage: [], + psuVoltageLastHour: [], + psuCurrent: [], + psuCurrentLastHour: [], powerSupplies: [], }, getters: { powerSupplies: (state) => state.powerSupplies, + psuTemp: (state) => state.psuTemp, + psuTempLastHour: (state) => state.psuTempLastHour, + psuPower: (state) => state.psuPower, + psuPowerLastHour: (state) => state.psuPowerLastHour, + psuVoltage: (state) => state.psuVoltage, + psuVoltageLastHour: (state) => state.psuVoltageLastHour, + psuCurrent: (state) => state.psuCurrent, + psuCurrentLastHour: (state) => state.psuCurrentLastHour, }, mutations: { setPowerSupply: (state, data) => { @@ -44,8 +60,50 @@ const PowerSupplyStore = { }; }); }, + setpsu_temp: (state, data) => { + state.psuTemp = data; + }, + setpsu_tempLastHour: (state, data) => { + state.psuTempLastHour = data; + }, + setpsu_voltage: (state, data) => { + state.psuVoltage = data; + }, + setpsu_voltageLastHour: (state, data) => { + state.psuVoltageLastHour = data; + }, + setpsu_power: (state, data) => { + state.psuPower = data; + }, + setpsu_powerLastHour: (state, data) => { + state.psuPowerLastHour = data; + }, + setpsu_current: (state, data) => { + state.psuCurrent = data; + }, + setpsu_currentLastHour: (state, data) => { + state.psuCurrentLastHour = data; + }, }, actions: { + async getPsu({ commit }, { lastHour, metricsName }) { + let url = null; + if (lastHour) { + url = `/redfish/v1/TelemetryService/MetricReports/${metricsName}&period=last_hour`; + } else { + url = `/redfish/v1/TelemetryService/MetricReports/${metricsName}`; + } + return await api + .get(url) + .then(({ data: { MetricValues = [] } }) => { + if (lastHour) { + commit(`set${metricsName}LastHour`, MetricValues); + } else { + commit(`set${metricsName}`, MetricValues); + } + }) + .catch((error) => console.log(error)); + }, async getChassisCollection() { return await api .get('/redfish/v1/Chassis') |