diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index 775e86e8..01f70156 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -1,4 +1,5 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const PowerSupplyStore = { namespaced: true, @@ -12,6 +13,7 @@ const PowerSupplyStore = { psuCurrent: [], psuCurrentLastHour: [], powerSupplies: [], + limitsTemp: [], }, getters: { powerSupplies: (state) => state.powerSupplies, @@ -23,6 +25,7 @@ const PowerSupplyStore = { psuVoltageLastHour: (state) => state.psuVoltageLastHour, psuCurrent: (state) => state.psuCurrent, psuCurrentLastHour: (state) => state.psuCurrentLastHour, + limitsTemp: (state) => state.limitsTemp, }, mutations: { setPowerSupply: (state, data) => { @@ -84,8 +87,39 @@ const PowerSupplyStore = { setpsu_currentLastHour: (state, data) => { state.psuCurrentLastHour = data; }, + setLimitsTemp: (state, data) => { + state.limitsTemp = data; + }, }, actions: { + async patchLimitsTemp({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pagePowerSup.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimitsTemp')); + }, + async getLimitsTemp({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimitsTemp', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getPsu({ commit }, { lastHour, metricsName }) { let url = null; if (lastHour) { |