summaryrefslogtreecommitdiff
path: root/src/views/_sila/Power/Dynamic/CurrentOutput.vue
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-26 14:50:55 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-26 14:50:55 +0300
commit5463c8aec08dfa07a01f95646e44a3b4bee070fe (patch)
treedc862824cffa5284db6c57308b0445071fbd2c5e /src/views/_sila/Power/Dynamic/CurrentOutput.vue
parent81e43ed3e15e2857faafc56edaf15ea1e1f63ec0 (diff)
downloadwebui-vue-5463c8aec08dfa07a01f95646e44a3b4bee070fe.tar.xz
optimization for dynamic
Diffstat (limited to 'src/views/_sila/Power/Dynamic/CurrentOutput.vue')
-rw-r--r--src/views/_sila/Power/Dynamic/CurrentOutput.vue13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/views/_sila/Power/Dynamic/CurrentOutput.vue b/src/views/_sila/Power/Dynamic/CurrentOutput.vue
index d796b3e7..a51c1fe6 100644
--- a/src/views/_sila/Power/Dynamic/CurrentOutput.vue
+++ b/src/views/_sila/Power/Dynamic/CurrentOutput.vue
@@ -108,6 +108,7 @@ export default {
warning: Infinity,
shutdown: Infinity,
isBusy: true,
+ opened: false,
fields: [
{
key: 'name',
@@ -162,6 +163,13 @@ export default {
},
},
watch: {
+ timeScale() {
+ if (!this.opened) {
+ return;
+ }
+
+ this.loadData();
+ },
items() {
this.items.length ? (this.isBusy = false) : (this.isBusy = true);
},
@@ -171,15 +179,18 @@ export default {
if (state) {
this.loadData();
}
+ this.opened = state;
},
loadData() {
let payload = { metricsName: 'psu_current', lastHour: false };
if (this.timeScale === 'hour') {
payload.lastHour = true;
}
+
+ this.$root.$emit('psu-current-output', true);
this.startLoader();
this.$store.dispatch('powerSupply/getPsu', payload).finally(() => {
- this.$root.$emit('psu-current');
+ this.$root.$emit('psu-current-output', false);
this.isBusy = false;
this.endLoader();
});