summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/FanStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/FanStore.js')
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js51
1 files changed, 40 insertions, 11 deletions
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index 8cae4d77..98dfb5be 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -4,13 +4,17 @@ import i18n from '@/i18n';
const FanStore = {
namespaced: true,
state: {
- fans: [],
- fansLastHour: [],
+ fansCpu: [],
+ fansCpuLastHour: [],
+ fansSystem: [],
+ fansSystemLastHour: [],
limits: [],
},
getters: {
- fans: (state) => state.fans,
- fansLastHour: (state) => state.fansLastHour,
+ fansCpu: (state) => state.fansCpu,
+ fansCpuLastHour: (state) => state.fansCpuLastHour,
+ fansSystem: (state) => state.fansCpu,
+ fansSystemLastHour: (state) => state.fansCpuLastHour,
limits: (state) => state.limits,
},
mutations: {
@@ -43,11 +47,17 @@ const FanStore = {
});
},
- setFansDynamic: (state, data) => {
- state.fans = data;
+ setFansCpu: (state, data) => {
+ state.fansCpu = data;
},
- setFansDynamicLastHour: (state, data) => {
- state.fansLastHour = data;
+ setFansCpuLastHour: (state, data) => {
+ state.fansCpuLastHour = data;
+ },
+ setFansSystem: (state, data) => {
+ state.fansSystem = data;
+ },
+ setFansSystemLastHour: (state, data) => {
+ state.fansSystemLastHour = data;
},
setLimits: (state, data) => {
state.limits = data;
@@ -88,7 +98,26 @@ const FanStore = {
})
.catch((error) => console.log(error));
},
- async getFansDynamic({ commit }, { lastHour }) {
+ 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 }) {
let url = null;
if (lastHour) {
url =
@@ -100,9 +129,9 @@ const FanStore = {
.get(url)
.then(({ data: { MetricValues = [] } }) => {
if (lastHour) {
- commit('setFansDynamicLastHour', MetricValues);
+ commit('setFansSystemLastHour', MetricValues);
} else {
- commit('setFansDynamic', MetricValues);
+ commit('setFansSystem', MetricValues);
}
})
.catch((error) => console.log(error));