From 0332cf97422e5989f466373ace45fee9babd2fb3 Mon Sep 17 00:00:00 2001
From: Maksim Zakharov <m.zakharov@IBS.RU>
Date: Mon, 8 Aug 2022 17:27:36 +0300
Subject: fix dymamic collapse

---
 src/views/_sila/Power/Dynamic/CurrentOutput.vue | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

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

diff --git a/src/views/_sila/Power/Dynamic/CurrentOutput.vue b/src/views/_sila/Power/Dynamic/CurrentOutput.vue
index 74c26d1b..bd353eb7 100644
--- a/src/views/_sila/Power/Dynamic/CurrentOutput.vue
+++ b/src/views/_sila/Power/Dynamic/CurrentOutput.vue
@@ -1,8 +1,8 @@
 <template>
   <collapse
     id="collapse_OutputCur"
-    default-open
     :title="$t('pagePowerSup.OutputCurrent')"
+    @opened="onOpened"
   >
     <template #image>
       <img src="@/assets/images/_sila/collapsed/current.svg" />
@@ -166,5 +166,24 @@ export default {
       this.items.length ? (this.isBusy = false) : (this.isBusy = true);
     },
   },
+  methods: {
+    onOpened(state) {
+      if (state) {
+        this.loadData();
+      }
+    },
+    loadData() {
+      let payload = { metricsName: 'psu_current', lastHour: false };
+      if (this.timeScale === 'hour') {
+        payload.lastHour = true;
+      }
+      this.startLoader();
+      this.$store.dispatch('powerSupply/getPsu', payload).finally(() => {
+        this.$root.$emit('psu-current');
+        this.isBusy = false;
+        this.endLoader();
+      });
+    },
+  },
 };
 </script>
-- 
cgit v1.2.3

