diff options
author | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
---|---|---|
committer | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
commit | e7444631a3a0da657ae829c4da51b4d378ba32e8 (patch) | |
tree | e12ed86503195ca21eb7a7366075c07f3231618f /src/store/modules | |
parent | c2010ac12e7cbf81e9c3e81589fd29e411de6b8d (diff) | |
parent | 0237b9c60425bbcd2417bf31000cbd74d0112645 (diff) | |
download | webui-vue-e7444631a3a0da657ae829c4da51b4d378ba32e8.tar.xz |
Merge branch 'sila' of git.sila.ru:pub/openbmc/webui-vue into sila
Diffstat (limited to 'src/store/modules')
-rw-r--r-- | src/store/modules/HardwareStatus/FanStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/MemoryStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/MotherboardStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/ProcessorStore.js | 34 |
5 files changed, 170 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) { 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) { diff --git a/src/store/modules/HardwareStatus/MotherboardStore.js b/src/store/modules/HardwareStatus/MotherboardStore.js index 09f24498..e565eaa0 100644 --- a/src/store/modules/HardwareStatus/MotherboardStore.js +++ b/src/store/modules/HardwareStatus/MotherboardStore.js @@ -1,14 +1,17 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const MotherboardStore = { namespaced: true, state: { motherboard: [], motherboardLastHour: [], + limits: [], }, getters: { motherboard: (state) => state.motherboard, motherboardLastHour: (state) => state.motherboardLastHour, + limits: (state) => state.limits, }, mutations: { setMotherboardDynamic: (state, data) => { @@ -17,8 +20,39 @@ const MotherboardStore = { setMotherboardDynamicLastHour: (state, data) => { state.motherboardLastHour = 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('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 getMotherboardDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index 775e86e8..01f70156 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -1,4 +1,5 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const PowerSupplyStore = { namespaced: true, @@ -12,6 +13,7 @@ const PowerSupplyStore = { psuCurrent: [], psuCurrentLastHour: [], powerSupplies: [], + limitsTemp: [], }, getters: { powerSupplies: (state) => state.powerSupplies, @@ -23,6 +25,7 @@ const PowerSupplyStore = { psuVoltageLastHour: (state) => state.psuVoltageLastHour, psuCurrent: (state) => state.psuCurrent, psuCurrentLastHour: (state) => state.psuCurrentLastHour, + limitsTemp: (state) => state.limitsTemp, }, mutations: { setPowerSupply: (state, data) => { @@ -84,8 +87,39 @@ const PowerSupplyStore = { setpsu_currentLastHour: (state, data) => { state.psuCurrentLastHour = 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('pagePowerSup.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 getPsu({ commit }, { lastHour, metricsName }) { let url = null; if (lastHour) { 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) { |