diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-26 14:50:55 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-26 14:50:55 +0300 |
commit | 5463c8aec08dfa07a01f95646e44a3b4bee070fe (patch) | |
tree | dc862824cffa5284db6c57308b0445071fbd2c5e /src/store/modules/HardwareStatus | |
parent | 81e43ed3e15e2857faafc56edaf15ea1e1f63ec0 (diff) | |
download | webui-vue-5463c8aec08dfa07a01f95646e44a3b4bee070fe.tar.xz |
optimization for dynamic
Diffstat (limited to 'src/store/modules/HardwareStatus')
-rw-r--r-- | src/store/modules/HardwareStatus/FanStore.js | 51 |
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)); |