summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/MemoryStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/MemoryStore.js')
-rw-r--r--src/store/modules/HardwareStatus/MemoryStore.js34
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) {