From 6cf3e66bcafbe161e9d9f7f3218f5944b4681658 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Mon, 29 Aug 2022 17:54:37 +0300 Subject: fx fans --- src/store/modules/HardwareStatus/FanStore.js | 8 ++++---- src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue | 24 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js index 43baf6b1..69e18532 100644 --- a/src/store/modules/HardwareStatus/FanStore.js +++ b/src/store/modules/HardwareStatus/FanStore.js @@ -10,8 +10,8 @@ const FanStore = { isLoading: false, }, getters: { - fans: (state) => state.fansCpu, - fansLastHour: (state) => state.fansCpuLastHour, + fans: (state) => state.fans, + fansLastHour: (state) => state.fansLastHour, limits: (state) => state.limits, isLoading: (state) => state.isLoading, }, @@ -46,10 +46,10 @@ const FanStore = { }, setFans: (state, data) => { - state.fansCpu = data; + state.fans = data; }, setFansLastHour: (state, data) => { - state.fansCpuLastHour = data; + state.fansLastHour = data; }, setLimits: (state, data) => { state.limits = data; diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue index a499a08d..a9582b2a 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue @@ -350,21 +350,29 @@ export default { payload = { lastHour: true }; } - this.$root.$emit('fan-system', true); - this.startLoader(); - this.isBusy = true; - this.$store.commit('fan/setIsLoading', true); + this.start(); this.$store.dispatch('fan/getFans', payload).finally(() => { this.$store.dispatch('fan/getLimits').finally(() => { this.warning = this.warningLimit; this.critical = this.criticalLimit; - this.$root.$emit('fan-system', false); - this.endLoader(); - this.isBusy = false; - this.$store.commit('fan/setIsLoading', false); + this.end(); }); }); }, + + start() { + this.startLoader(); + this.isBusy = true; + this.$store.commit('fan/setIsLoading', true); + this.$root.$emit('fan-system', true); + }, + + end() { + this.endLoader(); + this.isBusy = false; + this.$store.commit('fan/setIsLoading', false); + this.$root.$emit('fan-system', false); + }, }, }; -- cgit v1.2.3