diff options
Diffstat (limited to 'src/store/modules/HardwareStatus/FanStore.js')
-rw-r--r-- | src/store/modules/HardwareStatus/FanStore.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js index 26c20254..792c5ad1 100644 --- a/src/store/modules/HardwareStatus/FanStore.js +++ b/src/store/modules/HardwareStatus/FanStore.js @@ -1,14 +1,17 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const FanStore = { namespaced: true, state: { fans: [], fansLastHour: [], + limits: [], }, getters: { fans: (state) => state.fans, fansLastHour: (state) => state.fansLastHour, + limits: (state) => state.limits, }, mutations: { setFanInfo: (state, data) => { @@ -46,8 +49,39 @@ const FanStore = { setFansDynamicLastHour: (state, data) => { state.fansLastHour = 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', { + Speed: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageMotherboard.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 getFansDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { |