diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-16 18:43:55 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-16 18:43:55 +0300 |
commit | 143223d899c3c1373c76b851ad6933424277e9bb (patch) | |
tree | b40d7cc2875f914d0880adf82e8ffee0e4d4a87b /src/store | |
parent | 9145a3dfb6608188269a480f7c45a483166d332d (diff) | |
download | webui-vue-143223d899c3c1373c76b851ad6933424277e9bb.tar.xz |
SILABMC-256: add fields for memory
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/HardwareStatus/MemoryStore.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/MemoryStore.js b/src/store/modules/HardwareStatus/MemoryStore.js index 924d52a1..dd6c9a51 100644 --- a/src/store/modules/HardwareStatus/MemoryStore.js +++ b/src/store/modules/HardwareStatus/MemoryStore.js @@ -6,10 +6,12 @@ const MemoryStore = { state: { dimms: [], dimmsLastHour: [], + limits: [], }, getters: { dimms: (state) => state.dimms, dimmsLastHour: (state) => state.dimmsLastHour, + limits: (state) => state.limits, }, mutations: { setMemoryInfo: (state, data) => { @@ -62,8 +64,40 @@ const MemoryStore = { setMemoryDynamicLastHour: (state, data) => { state.dimmsLastHour = data; }, + + setLimits: (state, data) => { + state.limits = data; + }, }, actions: { + async patchLimits({ 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('pageMemory.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimits')); + }, + async getLimits({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimits', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getMemoryDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { |