diff options
Diffstat (limited to 'src/views/_sila/Power/Dynamic/VoltOutput.vue')
-rw-r--r-- | src/views/_sila/Power/Dynamic/VoltOutput.vue | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/views/_sila/Power/Dynamic/VoltOutput.vue b/src/views/_sila/Power/Dynamic/VoltOutput.vue index c5de746f..bc961feb 100644 --- a/src/views/_sila/Power/Dynamic/VoltOutput.vue +++ b/src/views/_sila/Power/Dynamic/VoltOutput.vue @@ -1,7 +1,7 @@ <template> <collapse id="collapse_OutputVolt" - :class="{ disabledDiv: loading && opened }" + :class="{ disabledDiv: (loading || isPageLoading) && opened }" :title="$t('pagePowerSup.OutputVolt')" @opened="onOpened" > @@ -55,7 +55,9 @@ variant="primary" style="height: 35px" :disabled=" - loading || $store.getters['authentication/role'] === 'ReadOnly' + loading || + isPageLoading || + $store.getters['authentication/role'] === 'ReadOnly' " @click="saveLimit" > @@ -72,6 +74,7 @@ :warning="warningLimit" :critical="criticalLimit" :max="maxLimit" + :opened="opened" ></chart> <b-table responsive="md" @@ -147,7 +150,7 @@ export default { loading, warning: null, critical: null, - isBusy: true, + isBusy: false, opened: false, fields: [ { @@ -205,6 +208,10 @@ export default { return this.$store.getters['powerSupply/limitsVol']; }, + isPageLoading() { + return this.$store.getters['powerSupply/isLoadingVol']; + }, + warningLimit() { return this.limits.find((limit) => { return ( @@ -247,13 +254,6 @@ export default { }, }, watch: { - items() { - if (this.items && this.items.length > 0) { - this.isBusy = false; - this.endLoader(); - } - }, - limits() { if (this.limits && this.limits.length > 0) { this.warning = this.warningLimit; @@ -292,24 +292,36 @@ export default { } this.opened = state; }, + loadData() { let payload = { metricsName: 'psu_voltage', lastHour: false }; if (this.timeScale === 'hour') { payload.lastHour = true; } - this.$root.$emit('psu-volt-input', true); - this.startLoader(); + this.start(); this.$store.dispatch('powerSupply/getPsu', payload).finally(() => { this.$store.dispatch('powerSupply/getLimitsVol').finally(() => { this.warning = this.warningLimit; this.critical = this.criticalLimit; - this.$root.$emit('psu-volt-output', false); - this.isBusy = false; - this.endLoader(); + this.end(); }); }); }, + + start() { + this.startLoader(); + this.isBusy = true; + this.$store.commit('powerSupply/setIsLoadingVol', true); + this.$root.$emit('psu-volt-output', true); + }, + + end() { + this.endLoader(); + this.isBusy = false; + this.$store.commit('powerSupply/setIsLoadingVol', false); + this.$root.$emit('psu-volt-output', false); + }, }, }; </script> |