From 0847eaf4cc4b050fc6f297940013a3e7e4c1cb81 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Thu, 25 Aug 2022 12:16:17 +0300 Subject: SILABMC-256: add limits for Voltage --- src/views/_sila/Power/Dynamic/VoltOutput.vue | 202 ++++++++++++++++++++++----- 1 file changed, 164 insertions(+), 38 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 f657b064..e03c04b6 100644 --- a/src/views/_sila/Power/Dynamic/VoltOutput.vue +++ b/src/views/_sila/Power/Dynamic/VoltOutput.vue @@ -8,41 +8,69 @@ - + {{ $t('global.action.save') }} + + + + { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + + criticalLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdCritical && this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdCritical; + }, + + maxLimit() { + return this.limits.find((limit) => { + return limit?.MaxReadingRange && this.groups.includes(limit.MemberId); + })?.MaxReadingRange; + }, + filteredItems() { return psuFilter(this.allSensors, 'Output'); }, @@ -162,10 +250,44 @@ export default { }, watch: { items() { - this.items.length ? (this.isBusy = false) : (this.isBusy = true); + if (this.items && this.items.length > 0) { + this.isBusy = false; + this.endLoader(); + } + }, + + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + + timeScale() { + this.loadData(); }, }, + + /*created() { + this.loadData(); + },*/ + methods: { + saveLimit() { + this.$v.$touch(); + if (this.$v.$invalid) return; + + this.startLoader(); + this.$store + .dispatch('powerSupply/patchLimitsVol', { + warning: this.warning, + critical: this.critical, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, + onOpened(state) { if (state) { this.loadData(); @@ -179,9 +301,13 @@ export default { this.startLoader(); this.$store.dispatch('powerSupply/getPsu', payload).finally(() => { - this.$root.$emit('psu-volt'); - this.isBusy = false; - this.endLoader(); + this.$store.dispatch('powerSupply/getLimitsVol').finally(() => { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + this.$root.$emit('psu-volt'); + this.isBusy = false; + this.endLoader(); + }); }); }, }, -- cgit v1.2.3