diff options
Diffstat (limited to 'src/views/_sila/Fans')
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue | 43 | ||||
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue | 25 | ||||
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FansDynamicPage.vue | 1 |
3 files changed, 51 insertions, 18 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> diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue index b86e1672..a499a08d 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedSystem.vue @@ -1,7 +1,7 @@ <template> <collapse id="collapse_FansSystem" - :class="{ disabledDiv: loading && opened }" + :class="{ disabledDiv: (loading || isPageLoading) && opened }" :title="$t('pageFans.speedSystem')" :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/fansSystemLastHour'] - : this.$store.getters['fan/fansSystem']; + ? this.$store.getters['fan/fansLastHour'] + : this.$store.getters['fan/fans']; }, preFiltered() { @@ -335,6 +341,10 @@ export default { }, loadData() { + if (this.isPageLoading) { + return; + } + let payload = { lastHour: false }; if (this.timeScale === 'hour') { payload = { lastHour: true }; @@ -342,13 +352,16 @@ export default { this.$root.$emit('fan-system', true); this.startLoader(); - this.$store.dispatch('fan/getFansSystem', payload).finally(() => { + this.isBusy = true; + this.$store.commit('fan/setIsLoading', true); + 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); }); }); }, diff --git a/src/views/_sila/Fans/Dynamic/FansDynamicPage.vue b/src/views/_sila/Fans/Dynamic/FansDynamicPage.vue index eaf3777c..ca9de7ff 100644 --- a/src/views/_sila/Fans/Dynamic/FansDynamicPage.vue +++ b/src/views/_sila/Fans/Dynamic/FansDynamicPage.vue @@ -47,7 +47,6 @@ export default { }, onChangePeriod(period) { this.timeScale = period; - this.startProgress(); this.resetZoom(); }, startProgress() { |