diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-17 09:37:28 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-17 09:37:28 +0300 |
commit | abfcb75c06375d3159a718334bca563feafcc466 (patch) | |
tree | be33a4fcf1fedca28bf9dfbfa788a98fcea8f1cd /src/store/modules | |
parent | eabebb2402a1282b447c4aa64a1ed158a05bcf45 (diff) | |
download | webui-vue-abfcb75c06375d3159a718334bca563feafcc466.tar.xz |
SILABMC-256: add fields for processors
Diffstat (limited to 'src/store/modules')
-rw-r--r-- | src/store/modules/HardwareStatus/ProcessorStore.js | 34 |
1 files changed, 34 insertions, 0 deletions
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) { |