diff options
Diffstat (limited to 'src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue')
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue index b4c5dfdd..fe7b2509 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue @@ -1,7 +1,7 @@ <template> <collapse id="collapse_FansCpu" - :class="{ disabledDiv: loading && opened }" + :class="{ disabledDiv: (loading || isPageLoading) && opened }" :title="$t('pageFans.speed')" :opened="true" @opened="onOpened" @@ -56,7 +56,9 @@ variant="primary" style="height: 35px" :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' + loading || + isPageLoading || + $store.getters['authentication/role'] === 'ReadOnly' " @click="saveLimit" > @@ -154,7 +156,7 @@ export default { loading, warning: null, critical: null, - isBusy: true, + isBusy: false, opened: false, fields: [ { @@ -236,6 +238,10 @@ export default { return this.$store.getters['fan/limits']; }, + isPageLoading() { + return this.$store.getters['fan/isLoading']; + }, + warningLimit() { return this.limits.find((limit) => { return ( @@ -261,8 +267,8 @@ export default { allSensors() { return this.timeScale === 'hour' - ? this.$store.getters['fan/fansCpuLastHour'] - : this.$store.getters['fan/fansCpu']; + ? this.$store.getters['fan/fansLastHour'] + : this.$store.getters['fan/fans']; }, preFiltered() { @@ -333,23 +339,38 @@ export default { }, loadData() { + if (this.isPageLoading) { + return; + } + let payload = { lastHour: false }; if (this.timeScale === 'hour') { payload = { lastHour: true }; } - this.$root.$emit('fan-cpu', true); - this.startLoader(); - this.$store.dispatch('fan/getFansCpu', payload).finally(() => { + 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-cpu', false); - this.endLoader(); - this.isBusy = false; + this.end(); }); }); }, + + start() { + this.startLoader(); + this.isBusy = true; + this.$store.commit('fan/setIsLoading', true); + this.$root.$emit('fan-cpu', true); + }, + + end() { + this.endLoader(); + this.isBusy = false; + this.$store.commit('fan/setIsLoading', false); + this.$root.$emit('fan-cpu', false); + }, }, }; </script> |