summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-17 10:01:26 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-17 10:01:26 +0300
commit0237b9c60425bbcd2417bf31000cbd74d0112645 (patch)
tree8b859a1fc8eaac0585af541dbf16b2f1e98c7fda /src/store/modules
parentabfcb75c06375d3159a718334bca563feafcc466 (diff)
downloadwebui-vue-0237b9c60425bbcd2417bf31000cbd74d0112645.tar.xz
SILABMC-256: add fields for power, temp
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/HardwareStatus/PowerSupplyStore.js34
1 files changed, 34 insertions, 0 deletions
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) {