diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-30 10:29:09 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-30 10:29:09 +0300 |
commit | 0444ab4658743504ddf12ddf911158aebf9037ae (patch) | |
tree | 137a99ea1286de38ab0670d61f4a284dbbd0b94b | |
parent | dc6694fc5801f0cf7d81b07380c043a1672e34e6 (diff) | |
download | webui-vue-0444ab4658743504ddf12ddf911158aebf9037ae.tar.xz |
upd power, dynamic
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 5 | ||||
-rw-r--r-- | src/views/_sila/Memory/Dynamic/MemoryTemp.vue | 7 | ||||
-rw-r--r-- | src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue | 7 | ||||
-rw-r--r-- | src/views/_sila/Power/Dynamic/PowerDynamicPage.vue | 1 | ||||
-rw-r--r-- | src/views/_sila/Power/Dynamic/PowerTemp.vue | 29 | ||||
-rw-r--r-- | src/views/_sila/Power/Dynamic/VoltInput.vue | 47 | ||||
-rw-r--r-- | src/views/_sila/Power/Dynamic/VoltOutput.vue | 42 | ||||
-rw-r--r-- | src/views/_sila/Processors/Dynamic/CpuPower.vue | 7 | ||||
-rw-r--r-- | src/views/_sila/Processors/Dynamic/CpuTemp.vue | 7 |
9 files changed, 122 insertions, 30 deletions
diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index e70d8dd0..7ff2909d 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -15,6 +15,7 @@ const PowerSupplyStore = { powerSupplies: [], limitsTemp: [], limitsVol: [], + isLoadingVol: false, }, getters: { powerSupplies: (state) => state.powerSupplies, @@ -28,6 +29,7 @@ const PowerSupplyStore = { psuCurrentLastHour: (state) => state.psuCurrentLastHour, limitsTemp: (state) => state.limitsTemp, limitsVol: (state) => state.limitsVol, + isLoadingVol: (state) => state.isLoadingVol, }, mutations: { setPowerSupply: (state, data) => { @@ -95,6 +97,9 @@ const PowerSupplyStore = { setLimitsVol: (state, data) => { state.limitsVol = data; }, + setIsLoadingVol: (state, data) => { + state.isLoadingVol = data; + }, }, actions: { async patchLimitsTemp({ dispatch }, { warning, critical, groups }) { diff --git a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue index 3fbf9da1..e374e807 100644 --- a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue +++ b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue @@ -240,6 +240,13 @@ export default { }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + timeScale() { this.loadData(); }, diff --git a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue index 0a6d2c3e..a8d1464b 100644 --- a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue +++ b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue @@ -208,6 +208,12 @@ export default { }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + } + }, + timeScale() { this.loadData(); }, @@ -231,6 +237,7 @@ export default { .catch(({ message }) => this.errorToast(message)) .finally(() => this.endLoader()); }, + loadData() { let payload = { lastHour: false }; if (this.timeScale === 'hour') { diff --git a/src/views/_sila/Power/Dynamic/PowerDynamicPage.vue b/src/views/_sila/Power/Dynamic/PowerDynamicPage.vue index 6a3c3433..c808148b 100644 --- a/src/views/_sila/Power/Dynamic/PowerDynamicPage.vue +++ b/src/views/_sila/Power/Dynamic/PowerDynamicPage.vue @@ -68,7 +68,6 @@ export default { onChangePeriod(period) { this.timeScale = period; - this.startProgress(); this.resetZoom(); }, startProgress() { diff --git a/src/views/_sila/Power/Dynamic/PowerTemp.vue b/src/views/_sila/Power/Dynamic/PowerTemp.vue index 1a8a4b58..2b08abf5 100644 --- a/src/views/_sila/Power/Dynamic/PowerTemp.vue +++ b/src/views/_sila/Power/Dynamic/PowerTemp.vue @@ -148,7 +148,7 @@ export default { loading, warning: null, critical: null, - isBusy: true, + isBusy: false, opened: false, fields: [ { @@ -246,6 +246,13 @@ export default { }, }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + timeScale() { if (!this.opened) { return; @@ -281,18 +288,28 @@ export default { if (this.timeScale === 'hour') { payload.lastHour = true; } - this.$root.$emit('psu-temp', true); - this.startLoader(); + + this.start(); this.$store.dispatch('powerSupply/getPsu', payload).finally(() => { this.$store.dispatch('powerSupply/getLimitsTemp').finally(() => { this.warning = this.warningLimit; this.critical = this.criticalLimit; - this.$root.$emit('psu-temp', false); - this.endLoader(); - this.isBusy = false; + this.end(); }); }); }, + + start() { + this.startLoader(); + this.isBusy = true; + this.$root.$emit('psu-temp', true); + }, + + end() { + this.endLoader(); + this.isBusy = false; + this.$root.$emit('psu-temp', false); + }, }, }; </script> diff --git a/src/views/_sila/Power/Dynamic/VoltInput.vue b/src/views/_sila/Power/Dynamic/VoltInput.vue index 7012f11b..794ca0d2 100644 --- a/src/views/_sila/Power/Dynamic/VoltInput.vue +++ b/src/views/_sila/Power/Dynamic/VoltInput.vue @@ -1,7 +1,7 @@ <template> <collapse id="collapse_InputVolt" - :class="{ disabledDiv: loading && opened }" + :class="{ disabledDiv: (loading || isPageLoading) && opened }" :title="$t('pagePowerSup.InputVolt')" @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,6 +254,13 @@ export default { }, }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + timeScale() { if (!this.opened) { return; @@ -270,30 +284,47 @@ export default { .catch(({ message }) => this.errorToast(message)) .finally(() => this.endLoader()); }, + onOpened(state) { if (state) { this.loadData(); } this.opened = state; }, + loadData() { + if (this.isPageLoading) { + return; + } + 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-input', false); - this.endLoader(); - this.isBusy = false; + this.end(); }); }); }, + + start() { + this.startLoader(); + this.isBusy = true; + this.$store.commit('powerSupply/setIsLoadingVol', true); + this.$root.$emit('psu-volt-input', true); + }, + + end() { + this.endLoader(); + this.isBusy = false; + this.$store.commit('powerSupply/setIsLoadingVol', false); + this.$root.$emit('psu-volt-input', false); + }, }, }; </script> 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> diff --git a/src/views/_sila/Processors/Dynamic/CpuPower.vue b/src/views/_sila/Processors/Dynamic/CpuPower.vue index 693c161d..79cd33b4 100644 --- a/src/views/_sila/Processors/Dynamic/CpuPower.vue +++ b/src/views/_sila/Processors/Dynamic/CpuPower.vue @@ -145,6 +145,13 @@ export default { }, }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + timeScale() { if (!this.opened) { return; diff --git a/src/views/_sila/Processors/Dynamic/CpuTemp.vue b/src/views/_sila/Processors/Dynamic/CpuTemp.vue index 9f2d60fa..8946bedd 100644 --- a/src/views/_sila/Processors/Dynamic/CpuTemp.vue +++ b/src/views/_sila/Processors/Dynamic/CpuTemp.vue @@ -253,6 +253,13 @@ export default { }, watch: { + limits() { + if (this.limits && this.limits.length > 0) { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + } + }, + timeScale() { if (!this.opened) { return; |