From 5463c8aec08dfa07a01f95646e44a3b4bee070fe Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Fri, 26 Aug 2022 14:50:55 +0300
Subject: optimization for dynamic

---
 src/views/_sila/Power/Dynamic/VoltOutput.vue | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'src/views/_sila/Power/Dynamic/VoltOutput.vue')

diff --git a/src/views/_sila/Power/Dynamic/VoltOutput.vue b/src/views/_sila/Power/Dynamic/VoltOutput.vue
index c31e89a8..c5de746f 100644
--- a/src/views/_sila/Power/Dynamic/VoltOutput.vue
+++ b/src/views/_sila/Power/Dynamic/VoltOutput.vue
@@ -1,6 +1,7 @@
 <template>
   <collapse
     id="collapse_OutputVolt"
+    :class="{ disabledDiv: loading && opened }"
     :title="$t('pagePowerSup.OutputVolt')"
     @opened="onOpened"
   >
@@ -147,6 +148,7 @@ export default {
       warning: null,
       critical: null,
       isBusy: true,
+      opened: false,
       fields: [
         {
           key: 'name',
@@ -260,14 +262,14 @@ export default {
     },
 
     timeScale() {
+      if (!this.opened) {
+        return;
+      }
+
       this.loadData();
     },
   },
 
-  /*created() {
-    this.loadData();
-  },*/
-
   methods: {
     saveLimit() {
       this.$v.$touch();
@@ -288,6 +290,7 @@ export default {
       if (state) {
         this.loadData();
       }
+      this.opened = state;
     },
     loadData() {
       let payload = { metricsName: 'psu_voltage', lastHour: false };
@@ -295,12 +298,13 @@ export default {
         payload.lastHour = true;
       }
 
+      this.$root.$emit('psu-volt-input', true);
       this.startLoader();
       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');
+          this.$root.$emit('psu-volt-output', false);
           this.isBusy = false;
           this.endLoader();
         });
-- 
cgit v1.2.3

