From abfcb75c06375d3159a718334bca563feafcc466 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Wed, 17 Aug 2022 09:37:28 +0300 Subject: SILABMC-256: add fields for processors --- src/store/modules/HardwareStatus/ProcessorStore.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/store/modules/HardwareStatus/ProcessorStore.js') diff --git a/src/store/modules/HardwareStatus/ProcessorStore.js b/src/store/modules/HardwareStatus/ProcessorStore.js index 68b29ab6..9a09dff4 100644 --- a/src/store/modules/HardwareStatus/ProcessorStore.js +++ b/src/store/modules/HardwareStatus/ProcessorStore.js @@ -8,12 +8,14 @@ const ProcessorStore = { cpuPower: [], cpuTempLastHour: [], cpuPowerLastHour: [], + limitsTemp: [], }, getters: { cpuTemp: (state) => state.cpuTemp, cpuPower: (state) => state.cpuPower, cpuTempLastHour: (state) => state.cpuTempLastHour, cpuPowerLastHour: (state) => state.cpuPowerLastHour, + limitsTemp: (state) => state.limitsTemp, }, mutations: { setProcessorsInfo: (state, data) => { @@ -78,8 +80,40 @@ const ProcessorStore = { setCpuPowerDynamicLastHour: (state, data) => { state.cpuPowerLastHour = 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('pageProcessor.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 getCpuPowerDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { -- cgit v1.2.3