summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-29 17:45:10 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-29 17:45:10 +0300
commit214d4d58742478b1e9ad3d0549568a92114179b8 (patch)
treef239785783a317ef36497356b13a07b02f3e1eac /src/store
parent10f5207c77b16b46f637f77520964c82226d27fb (diff)
downloadwebui-vue-214d4d58742478b1e9ad3d0549568a92114179b8.tar.xz
one req for fans, dynamic
Diffstat (limited to 'src/store')
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js52
1 files changed, 14 insertions, 38 deletions
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index 98dfb5be..43baf6b1 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -4,18 +4,16 @@ import i18n from '@/i18n';
const FanStore = {
namespaced: true,
state: {
- fansCpu: [],
- fansCpuLastHour: [],
- fansSystem: [],
- fansSystemLastHour: [],
+ fans: [],
+ fansLastHour: [],
limits: [],
+ isLoading: false,
},
getters: {
- fansCpu: (state) => state.fansCpu,
- fansCpuLastHour: (state) => state.fansCpuLastHour,
- fansSystem: (state) => state.fansCpu,
- fansSystemLastHour: (state) => state.fansCpuLastHour,
+ fans: (state) => state.fansCpu,
+ fansLastHour: (state) => state.fansCpuLastHour,
limits: (state) => state.limits,
+ isLoading: (state) => state.isLoading,
},
mutations: {
setFanInfo: (state, data) => {
@@ -47,21 +45,18 @@ const FanStore = {
});
},
- setFansCpu: (state, data) => {
+ setFans: (state, data) => {
state.fansCpu = data;
},
- setFansCpuLastHour: (state, data) => {
+ setFansLastHour: (state, data) => {
state.fansCpuLastHour = data;
},
- setFansSystem: (state, data) => {
- state.fansSystem = data;
- },
- setFansSystemLastHour: (state, data) => {
- state.fansSystemLastHour = data;
- },
setLimits: (state, data) => {
state.limits = data;
},
+ setIsLoading: (state, data) => {
+ state.isLoading = data;
+ },
},
actions: {
async patchLimits({ dispatch }, { warning, critical, groups }) {
@@ -98,26 +93,7 @@ const FanStore = {
})
.catch((error) => console.log(error));
},
- async getFansCpu({ commit }, { lastHour }) {
- let url = null;
- if (lastHour) {
- url =
- '/redfish/v1/TelemetryService/MetricReports/fans&period=last_hour';
- } else {
- url = '/redfish/v1/TelemetryService/MetricReports/fans';
- }
- return await api
- .get(url)
- .then(({ data: { MetricValues = [] } }) => {
- if (lastHour) {
- commit('setFansCpuLastHour', MetricValues);
- } else {
- commit('setFansCpu', MetricValues);
- }
- })
- .catch((error) => console.log(error));
- },
- async getFansSystem({ commit }, { lastHour }) {
+ async getFans({ commit }, { lastHour }) {
let url = null;
if (lastHour) {
url =
@@ -129,9 +105,9 @@ const FanStore = {
.get(url)
.then(({ data: { MetricValues = [] } }) => {
if (lastHour) {
- commit('setFansSystemLastHour', MetricValues);
+ commit('setFansLastHour', MetricValues);
} else {
- commit('setFansSystem', MetricValues);
+ commit('setFans', MetricValues);
}
})
.catch((error) => console.log(error));