From 7d5e7b6f494c16640790734c39ffb2f1ed511358 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Tue, 16 Aug 2022 13:16:28 +0300 Subject: SILABMC-256: patch/get for limits --- .../modules/HardwareStatus/MotherboardStore.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/store/modules/HardwareStatus/MotherboardStore.js') diff --git a/src/store/modules/HardwareStatus/MotherboardStore.js b/src/store/modules/HardwareStatus/MotherboardStore.js index 09f24498..eecd3bc7 100644 --- a/src/store/modules/HardwareStatus/MotherboardStore.js +++ b/src/store/modules/HardwareStatus/MotherboardStore.js @@ -5,10 +5,12 @@ const MotherboardStore = { state: { motherboard: [], motherboardLastHour: [], + limits: [], }, getters: { motherboard: (state) => state.motherboard, motherboardLastHour: (state) => state.motherboardLastHour, + limits: (state) => state.limits, }, mutations: { setMotherboardDynamic: (state, data) => { @@ -17,8 +19,36 @@ const MotherboardStore = { setMotherboardDynamicLastHour: (state, data) => { state.motherboardLastHour = data; }, + setLimits: (state, data) => { + state.limits = data; + }, }, actions: { + async patchLimits() { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => + Temperatures.map((temperature) => + api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: temperature.MemberId, + UpperThresholdNonCritical: 7, + }, + ], + }) + ) + ) + .catch((error) => console.log(error)); + }, + 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 getMotherboardDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { -- cgit v1.2.3