diff options
author | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
---|---|---|
committer | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
commit | e7444631a3a0da657ae829c4da51b4d378ba32e8 (patch) | |
tree | e12ed86503195ca21eb7a7366075c07f3231618f | |
parent | c2010ac12e7cbf81e9c3e81589fd29e411de6b8d (diff) | |
parent | 0237b9c60425bbcd2417bf31000cbd74d0112645 (diff) | |
download | webui-vue-e7444631a3a0da657ae829c4da51b4d378ba32e8.tar.xz |
Merge branch 'sila' of git.sila.ru:pub/openbmc/webui-vue into sila
-rw-r--r-- | src/components/_sila/Global/Chart.vue | 206 | ||||
-rw-r--r-- | src/locales/en-US.json | 12 | ||||
-rw-r--r-- | src/locales/ru-RU.json | 12 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/FanStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/MemoryStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/MotherboardStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/PowerSupplyStore.js | 34 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/ProcessorStore.js | 34 | ||||
-rw-r--r-- | src/utilities/_sila/metricProperties.js | 9 | ||||
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue | 65 | ||||
-rw-r--r-- | src/views/_sila/Memory/Dynamic/MemoryTemp.vue | 82 | ||||
-rw-r--r-- | src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue | 51 | ||||
-rw-r--r-- | src/views/_sila/Power/Dynamic/PowerTemp.vue | 85 | ||||
-rw-r--r-- | src/views/_sila/Processors/Dynamic/CpuTemp.vue | 84 |
14 files changed, 584 insertions, 192 deletions
diff --git a/src/components/_sila/Global/Chart.vue b/src/components/_sila/Global/Chart.vue index ac8fc325..01e54071 100644 --- a/src/components/_sila/Global/Chart.vue +++ b/src/components/_sila/Global/Chart.vue @@ -54,27 +54,6 @@ export default { yMax: null, minTickInterval: null, plotBands: null, - plotLines: [ - { - color: '#E11717', - dashStyle: 'solid', - value: this.warning, - zIndex: '1000', - width: 2, - label: { - text: this.$t('chart.thresholdWarning'), - align: 'right', - style: { - fontFamily: 'Inter, sans-serif', - fontSize: '12px', - fontStyle: 'normal', - fontWeight: '400', - lineHeight: '16px', - color: '#0C1C2999', - }, - }, - }, - ], }; }, computed: { @@ -200,20 +179,33 @@ export default { }, }; }, - }, - async created() { - this.setOptions(); - }, + plotLines() { + let plotLines = [ + { + color: '#E11717', + dashStyle: 'solid', + value: this.warning, + zIndex: '1000', + width: 2, + label: { + text: this.$t('chart.thresholdWarning'), + align: 'right', + style: { + fontFamily: 'Inter, sans-serif', + fontSize: '12px', + fontStyle: 'normal', + fontWeight: '400', + lineHeight: '16px', + color: '#0C1C2999', + }, + }, + }, + ]; - methods: { - setOptions() { switch (this.type) { case 'fans': - this.categories = this.setSpeed(10000); - this.minRange = 10000; - this.minTickInterval = 1000; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -232,54 +224,8 @@ export default { }, }); break; - case 'memory': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotBands = [ - { - color: '#F0AC0C1A', - dashStyle: 'solid', - from: this.notNormal, - to: this.critical, - }, - { - color: '#FF41411A', - dashStyle: 'solid', - from: this.critical, - to: this.warning, - }, - ]; - break; - case 'processors': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotBands = [ - { - color: '#F0AC0C1A', - dashStyle: 'solid', - from: this.notNormal, - to: this.critical, - }, - { - color: '#FF41411A', - dashStyle: 'solid', - from: this.critical, - to: this.warning, - }, - ]; - break; - case 'motherboard': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - break; case 'power': - this.categories = this.setCategories(101, 'Вт'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -299,10 +245,7 @@ export default { }); break; case 'voltage-input': - this.categories = this.setCategories(251, 'В'); - this.yMax = 250; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -322,10 +265,7 @@ export default { }); break; case 'voltage-output': - this.categories = this.setCategories(101, 'В'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -345,10 +285,7 @@ export default { }); break; case 'current': - this.categories = this.setCategories(11, 'A'); - this.yMax = 10; - this.minTickInterval = 2; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -368,10 +305,7 @@ export default { }); break; case 'psu-power': - this.categories = this.setCategories(126, 'Вт'); - this.yMax = 125; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -390,6 +324,90 @@ export default { }, }); } + return plotLines; + }, + }, + + async created() { + this.setOptions(); + }, + + methods: { + setOptions() { + switch (this.type) { + case 'fans': + this.categories = this.setSpeed(10000); + this.minRange = 10000; + this.minTickInterval = 1000; + break; + case 'memory': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + this.plotBands = [ + { + color: '#F0AC0C1A', + dashStyle: 'solid', + from: this.notNormal, + to: this.critical, + }, + { + color: '#FF41411A', + dashStyle: 'solid', + from: this.critical, + to: this.warning, + }, + ]; + break; + case 'processors': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + this.plotBands = [ + { + color: '#F0AC0C1A', + dashStyle: 'solid', + from: this.notNormal, + to: this.critical, + }, + { + color: '#FF41411A', + dashStyle: 'solid', + from: this.critical, + to: this.warning, + }, + ]; + break; + case 'motherboard': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'power': + this.categories = this.setCategories(101, 'Вт'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'voltage-input': + this.categories = this.setCategories(251, 'В'); + this.yMax = 250; + this.minTickInterval = 25; + break; + case 'voltage-output': + this.categories = this.setCategories(101, 'В'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'current': + this.categories = this.setCategories(11, 'A'); + this.yMax = 10; + this.minTickInterval = 2; + break; + case 'psu-power': + this.categories = this.setCategories(126, 'Вт'); + this.yMax = 125; + this.minTickInterval = 25; + } }, setCategories(count, desc) { const arr = [...new Array(count)].map((i, k) => `${k} ${desc}`); diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 768b499c..7ccf4654 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -881,6 +881,9 @@ "temperature": "Temperature indicators", "labels": { "warning": "Meaning of the warning" + }, + "toast": { + "errorLimitUpdate": "Limit update error" } }, "pageProcessors": { @@ -892,6 +895,9 @@ "warning": "Warning", "shutdown": "Shutdown" }, + "toast": { + "errorLimitUpdate": "Limit update error" + }, "table": { "temperature": { "name": "Name", @@ -923,6 +929,9 @@ "minDate": "Date of minimum", "maxTemperature": "Maximum, С°", "maxDate": "Date of maximum" + }, + "toast": { + "errorLimitUpdate": "Limit update error" } }, "pagePowerSup": { @@ -940,6 +949,9 @@ "warning": "Meaning of the warning", "shutdown": "Shutdown" }, + "toast": { + "errorLimitUpdate": "Limit update error" + }, "table": { "param": "Parameter", "value": "Значение", diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 13e6fcac..83cf8b2e 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -881,6 +881,9 @@ "temperature": "Показатели температуры", "labels": { "warning": "Значение предупреждения" + }, + "toast": { + "errorLimitUpdate": "Ошибка обновления предела" } }, "pageProcessors": { @@ -892,6 +895,9 @@ "warning": "Значение предупреждения", "shutdown": "Значение отказа" }, + "toast": { + "errorLimitUpdate": "Ошибка обновления предела" + }, "table": { "temperature": { "name": "Имя модуля", @@ -923,6 +929,9 @@ "minDate": "Дата минимального", "maxTemperature": "Максимальное, С°", "maxDate": "Дата максимального" + }, + "toast": { + "errorLimitUpdate": "Ошибка обновления предела" } }, "pagePowerSup": { @@ -934,6 +943,9 @@ "OutputVolt": "Выходное напряжение", "InputCurrent": "Входная сила тока", "OutputCurrent": "Выходная сила тока", + "toast": { + "errorLimitUpdate": "Ошибка обновления предела" + }, "labels": { "notNormal": "Не штатный режим", "critical": "Критический режим", diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js index 26c20254..792c5ad1 100644 --- a/src/store/modules/HardwareStatus/FanStore.js +++ b/src/store/modules/HardwareStatus/FanStore.js @@ -1,14 +1,17 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const FanStore = { namespaced: true, state: { fans: [], fansLastHour: [], + limits: [], }, getters: { fans: (state) => state.fans, fansLastHour: (state) => state.fansLastHour, + limits: (state) => state.limits, }, mutations: { setFanInfo: (state, data) => { @@ -46,8 +49,39 @@ const FanStore = { setFansDynamicLastHour: (state, data) => { state.fansLastHour = data; }, + setLimits: (state, data) => { + state.limits = data; + }, }, actions: { + async patchLimits({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Speed: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageMotherboard.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimits')); + }, + async getLimits({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimits', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getFansDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { diff --git a/src/store/modules/HardwareStatus/MemoryStore.js b/src/store/modules/HardwareStatus/MemoryStore.js index 924d52a1..dd6c9a51 100644 --- a/src/store/modules/HardwareStatus/MemoryStore.js +++ b/src/store/modules/HardwareStatus/MemoryStore.js @@ -6,10 +6,12 @@ const MemoryStore = { state: { dimms: [], dimmsLastHour: [], + limits: [], }, getters: { dimms: (state) => state.dimms, dimmsLastHour: (state) => state.dimmsLastHour, + limits: (state) => state.limits, }, mutations: { setMemoryInfo: (state, data) => { @@ -62,8 +64,40 @@ const MemoryStore = { setMemoryDynamicLastHour: (state, data) => { state.dimmsLastHour = data; }, + + setLimits: (state, data) => { + state.limits = data; + }, }, actions: { + async patchLimits({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageMemory.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimits')); + }, + async getLimits({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimits', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getMemoryDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { diff --git a/src/store/modules/HardwareStatus/MotherboardStore.js b/src/store/modules/HardwareStatus/MotherboardStore.js index 09f24498..e565eaa0 100644 --- a/src/store/modules/HardwareStatus/MotherboardStore.js +++ b/src/store/modules/HardwareStatus/MotherboardStore.js @@ -1,14 +1,17 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const MotherboardStore = { namespaced: true, state: { motherboard: [], motherboardLastHour: [], + limits: [], }, getters: { motherboard: (state) => state.motherboard, motherboardLastHour: (state) => state.motherboardLastHour, + limits: (state) => state.limits, }, mutations: { setMotherboardDynamic: (state, data) => { @@ -17,8 +20,39 @@ const MotherboardStore = { setMotherboardDynamicLastHour: (state, data) => { state.motherboardLastHour = data; }, + setLimits: (state, data) => { + state.limits = data; + }, }, actions: { + async patchLimits({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageMotherboard.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimits')); + }, + async getLimits({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimits', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getMotherboardDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { diff --git a/src/store/modules/HardwareStatus/PowerSupplyStore.js b/src/store/modules/HardwareStatus/PowerSupplyStore.js index 775e86e8..01f70156 100644 --- a/src/store/modules/HardwareStatus/PowerSupplyStore.js +++ b/src/store/modules/HardwareStatus/PowerSupplyStore.js @@ -1,4 +1,5 @@ import api from '@/store/api'; +import i18n from '@/i18n'; const PowerSupplyStore = { namespaced: true, @@ -12,6 +13,7 @@ const PowerSupplyStore = { psuCurrent: [], psuCurrentLastHour: [], powerSupplies: [], + limitsTemp: [], }, getters: { powerSupplies: (state) => state.powerSupplies, @@ -23,6 +25,7 @@ const PowerSupplyStore = { psuVoltageLastHour: (state) => state.psuVoltageLastHour, psuCurrent: (state) => state.psuCurrent, psuCurrentLastHour: (state) => state.psuCurrentLastHour, + limitsTemp: (state) => state.limitsTemp, }, mutations: { setPowerSupply: (state, data) => { @@ -84,8 +87,39 @@ const PowerSupplyStore = { setpsu_currentLastHour: (state, data) => { state.psuCurrentLastHour = data; }, + setLimitsTemp: (state, data) => { + state.limitsTemp = data; + }, }, actions: { + async patchLimitsTemp({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pagePowerSup.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimitsTemp')); + }, + async getLimitsTemp({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimitsTemp', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getPsu({ commit }, { lastHour, metricsName }) { let url = null; if (lastHour) { diff --git a/src/store/modules/HardwareStatus/ProcessorStore.js b/src/store/modules/HardwareStatus/ProcessorStore.js index 68b29ab6..9a09dff4 100644 --- a/src/store/modules/HardwareStatus/ProcessorStore.js +++ b/src/store/modules/HardwareStatus/ProcessorStore.js @@ -8,12 +8,14 @@ const ProcessorStore = { cpuPower: [], cpuTempLastHour: [], cpuPowerLastHour: [], + limitsTemp: [], }, getters: { cpuTemp: (state) => state.cpuTemp, cpuPower: (state) => state.cpuPower, cpuTempLastHour: (state) => state.cpuTempLastHour, cpuPowerLastHour: (state) => state.cpuPowerLastHour, + limitsTemp: (state) => state.limitsTemp, }, mutations: { setProcessorsInfo: (state, data) => { @@ -78,8 +80,40 @@ const ProcessorStore = { setCpuPowerDynamicLastHour: (state, data) => { state.cpuPowerLastHour = data; }, + + setLimitsTemp: (state, data) => { + state.limitsTemp = data; + }, }, actions: { + async patchLimitsTemp({ dispatch }, { warning, groups }) { + return Promise.all( + groups.map( + async (group) => + await api.patch('/redfish/v1/Chassis/SILA_Baseboard/Thermal', { + Temperatures: [ + { + MemberId: group, + UpperThresholdNonCritical: warning, + }, + ], + }) + ) + ) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageProcessor.toast.errorLimitUpdate')); + }) + .finally(() => dispatch('getLimitsTemp')); + }, + async getLimitsTemp({ commit }) { + return await api + .get('/redfish/v1/Chassis/SILA_Baseboard/Thermal') + .then(({ data: { Temperatures = [] } }) => { + commit('setLimitsTemp', Temperatures); + }) + .catch((error) => console.log(error)); + }, async getCpuPowerDynamic({ commit }, { lastHour }) { let url = null; if (lastHour) { diff --git a/src/utilities/_sila/metricProperties.js b/src/utilities/_sila/metricProperties.js index edc701d6..e435bab2 100644 --- a/src/utilities/_sila/metricProperties.js +++ b/src/utilities/_sila/metricProperties.js @@ -1,3 +1,12 @@ +export function getGroups(data) { + return Object.keys( + data.reduce(function (rv, x) { + (rv[x['Sensor']] = rv[x['Sensor']] || []).push(x); + return rv; + }, {}) + ); +} + export function getItems(data, float = false) { let filteredData = data.filter((metric) => { return metric.Value !== 'nan'; diff --git a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue index 10f6c9c5..018e19a1 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeedCpu.vue @@ -8,11 +8,11 @@ <img src="@/assets/images/_sila/collapsed/fan.svg" /> </template> <page-section> - <!-- <b-row class="align-items-end limit-container"> + <!-- <b-row class="align-items-end limit-container"> <b-col xs="12" md="6" xl="3" class="pt-4"> <b-form-group :label="$t('pageFans.labels.warning')"> <b-form-input - v-model="warning" + v-model.number="warning" type="number" :min="0" :max="shutdown" @@ -23,7 +23,7 @@ <b-col xs="12" md="6" xl="3" class="pt-4"> <b-form-group :label="$t('pageFans.labels.shutdown')"> <b-form-input - v-model="shutdown" + v-model.number="shutdown" :min="warning" :max="10000" type="number" @@ -31,18 +31,18 @@ </b-form-group> </b-col> <b-col xs="12" md="6" xl="3" class="pt-4"> - <b-button variant="primary" style="height: 35px"> + <b-button variant="primary" style="height: 35px" @click="saveLimit"> {{ $t('global.action.save') }} </b-button> </b-col> - </b-row> --> + </b-row>--> <chart type="fans" :colors="colors" :time-scale="timeScale" :data="filteredForChart" - :warning="warning" - :shutdown="shutdown" + :warning="warningLimit" + :shutdown="shutdownLimit" ></chart> <b-table @@ -94,14 +94,15 @@ import PageSection from '@/components/Global/PageSection'; import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; import Collapse from '@/components/_sila/Global/Collapse'; -import { getItems } from '@/utilities/_sila/metricProperties'; +import { getGroups, getItems } from '@/utilities/_sila/metricProperties'; import { fanFilter } from '@/utilities/_sila/psuFilter'; export default { components: { PageSection, Chart, Collapse }, - mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin], + mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin, BVToastMixin], props: { timeScale: { type: String, @@ -110,8 +111,8 @@ export default { }, data() { return { - warning: 7500, - shutdown: 8500, + warning: null, + shutdown: null, isBusy: true, fields: [ { @@ -151,6 +152,9 @@ export default { }, computed: { + groups() { + return getGroups(this.filteredSensors); + }, items() { const allArr = getItems(this.filteredSensors); @@ -172,6 +176,27 @@ export default { }); }, + limits() { + return this.$store.getters['fan/limits']; + }, + + warningLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + + shutdownLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdCritical && this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdCritical; + }, + allSensors() { return this.timeScale === 'hour' ? this.$store.getters['fan/fansLastHour'] @@ -212,6 +237,16 @@ export default { }, methods: { + saveLimit() { + this.startLoader(); + this.$store + .dispatch('fan/patchLimits', { + warning: this.warning, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, getPwmByCpu(cpu) { switch (cpu) { case 'CPU1_Fan': @@ -237,8 +272,12 @@ export default { this.startLoader(); this.$store.dispatch('fan/getFansDynamic', payload).finally(() => { - this.endLoader(); - this.isBusy = false; + this.$store.dispatch('fan/getLimits').finally(() => { + this.warning = this.warningLimit; + this.shutdown = this.shutdownLimit; + this.endLoader(); + this.isBusy = false; + }); }); }, }, diff --git a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue index 3505f827..f69e797a 100644 --- a/src/views/_sila/Memory/Dynamic/MemoryTemp.vue +++ b/src/views/_sila/Memory/Dynamic/MemoryTemp.vue @@ -4,11 +4,11 @@ <img src="@/assets/images/_sila/collapsed/temperature.svg" /> {{ $t('pageMemory.temperature') }} </b-col> - <!-- <b-row class="align-items-end limit-container"> + <b-row class="align-items-end limit-container"> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pageMemory.labels.notNormal')"> + <b-form-group :label="$t('pageMemory.labels.warning')"> <b-form-input - v-model="notNormal" + v-model.number="warning" type="number" :min="0" :max="critical" @@ -18,39 +18,27 @@ <b-col xs="12" sm="6" xl="3" class="pt-4"> <b-form-group :label="$t('pageMemory.labels.critical')"> <b-form-input - v-model="critical" - type="number" - :min="notNormal" - :max="warning" - > - </b-form-input> - </b-form-group> - </b-col> - <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pageMemory.labels.warning')"> - <b-form-input - v-model="warning" + v-model.number="critical" type="number" - :min="critical" + :min="warning" :max="100" > </b-form-input> </b-form-group> </b-col> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-button variant="primary" style="height: 35px"> + <b-button variant="primary" style="height: 35px" @click="saveLimit"> {{ $t('global.action.save') }} </b-button> </b-col> - </b-row> --> + </b-row> <chart type="memory" :colors="colors" :time-scale="timeScale" :data="filteredSensors" - :warning="warning" - :not-normal="notNormal" - :critical="critical" + :warning="warningLimit" + :critical="criticalLimit" ></chart> <b-table responsive="md" @@ -94,12 +82,13 @@ import Chart from '@/components/_sila/Global/Chart'; import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; -import { getItems } from '@/utilities/_sila/metricProperties'; +import { getGroups, getItems } from '@/utilities/_sila/metricProperties'; export default { components: { Chart }, - mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin], + mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin, BVToastMixin], props: { timeScale: { type: String, @@ -108,9 +97,8 @@ export default { }, data() { return { - warning: 72, - notNormal: 44, - critical: 55, + warning: null, + critical: null, isBusy: true, fields: [ { @@ -146,10 +134,34 @@ export default { }, computed: { + groups() { + return getGroups(this.filteredSensors); + }, items() { return getItems(this.filteredSensors); }, + limits() { + return this.$store.getters['memory/limits']; + }, + + warningLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + + criticalLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdCritical && this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdCritical; + }, + allSensors() { return this.timeScale === 'hour' ? this.$store.getters['memory/dimmsLastHour'] @@ -180,6 +192,16 @@ export default { }, methods: { + saveLimit() { + this.startLoader(); + this.$store + .dispatch('memory/patchLimits', { + warning: this.warning, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, loadData() { let payload = { lastHour: false }; if (this.timeScale === 'hour') { @@ -188,8 +210,12 @@ export default { this.startLoader(); this.$store.dispatch('memory/getMemoryDynamic', payload).finally(() => { - this.endLoader(); - this.isBusy = false; + this.$store.dispatch('memory/getLimits').finally(() => { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + this.endLoader(); + this.isBusy = false; + }); }); }, }, diff --git a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue index f01c4280..5fac0a89 100644 --- a/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue +++ b/src/views/_sila/Motherboard/Dynamic/MotherboardTemp.vue @@ -5,11 +5,11 @@ {{ $t('pageMotherboard.temperature') }} </b-col> - <!-- <b-row class="align-items-end limit-container"> + <b-row class="align-items-end limit-container"> <b-col xs="12" sm="6" xl="3" class="pt-4"> <b-form-group :label="$t('pageMotherboard.labels.warning')"> <b-form-input - v-model="warning" + v-model.number="warning" type="number" :min="0" :max="100" @@ -17,17 +17,17 @@ </b-form-group> </b-col> <b-col xs="12" sm="6" class="pt-4"> - <b-button variant="primary" style="height: 35px"> + <b-button variant="primary" style="height: 35px" @click="saveLimit"> {{ $t('global.action.save') }} </b-button> </b-col> - </b-row> --> + </b-row> <chart type="motherboard" :time-scale="timeScale" :colors="colors" :data="filteredSensors" - :warning="warning" + :warning="warningLimit" ></chart> <b-table responsive="md" @@ -71,12 +71,13 @@ import Chart from '@/components/_sila/Global/Chart'; import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; -import { getItems } from '@/utilities/_sila/metricProperties'; +import { getItems, getGroups } from '@/utilities/_sila/metricProperties'; export default { components: { Chart }, - mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin], + mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin, BVToastMixin], props: { timeScale: { type: String, @@ -85,7 +86,7 @@ export default { }, data() { return { - warning: 72, + warning: null, isBusy: true, fields: [ { @@ -121,10 +122,27 @@ export default { }, computed: { + groups() { + return getGroups(this.filteredSensors); + }, + items() { return getItems(this.filteredSensors); }, + limits() { + return this.$store.getters['motherboard/limits']; + }, + + warningLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + allSensors() { return this.timeScale === 'hour' ? this.$store.getters['motherboard/motherboardLastHour'] @@ -155,6 +173,16 @@ export default { }, methods: { + saveLimit() { + this.startLoader(); + this.$store + .dispatch('motherboard/patchLimits', { + warning: this.warning, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, loadData() { let payload = { lastHour: false }; if (this.timeScale === 'hour') { @@ -165,8 +193,11 @@ export default { this.$store .dispatch('motherboard/getMotherboardDynamic', payload) .finally(() => { - this.endLoader(); - this.isBusy = false; + this.$store.dispatch('motherboard/getLimits').finally(() => { + this.warning = this.warningLimit; + this.endLoader(); + this.isBusy = false; + }); }); }, }, diff --git a/src/views/_sila/Power/Dynamic/PowerTemp.vue b/src/views/_sila/Power/Dynamic/PowerTemp.vue index e0d4d154..1d18e8b1 100644 --- a/src/views/_sila/Power/Dynamic/PowerTemp.vue +++ b/src/views/_sila/Power/Dynamic/PowerTemp.vue @@ -8,43 +8,42 @@ <img src="@/assets/images/_sila/collapsed/temperature.svg" /> </template> <page-section> - <!-- <b-row class="align-items-end limit-container"> + <b-row class="align-items-end limit-container"> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pagePowerSup.labels.notNormal')"> + <b-form-group :label="$t('pagePowerSup.labels.warning')"> <b-form-input - v-model="notNormal" + v-model.number="warning" type="number" :min="0" :max="100" - ></b-form-input> - </b-form-group> - </b-col> - <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pagePowerSup.labels.critical')"> - <b-form-input v-model="critical" type="number" :min="0" :max="100"> + > </b-form-input> </b-form-group> </b-col> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pagePowerSup.labels.warning')"> - <b-form-input v-model="warning" type="number" :min="0" :max="100"> + <b-form-group :label="$t('pagePowerSup.labels.critical')"> + <b-form-input + v-model.number="critical" + type="number" + :min="0" + :max="100" + > </b-form-input> </b-form-group> </b-col> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-button variant="primary" style="height: 35px"> + <b-button variant="primary" style="height: 35px" @click="saveLimit"> {{ $t('global.action.save') }} </b-button> </b-col> - </b-row> --> + </b-row> <chart type="processors" :time-scale="timeScale" :data="allSensors" :colors="colors" - :warning="+warning" - :not-normal="+notNormal" - :critical="+critical" + :warning="warningLimit" + :critical="criticalLimit" ></chart> <b-table responsive="md" @@ -90,13 +89,14 @@ import PageSection from '@/components/Global/PageSection'; import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; import Collapse from '@/components/_sila/Global/Collapse'; -import { getItems } from '@/utilities/_sila/metricProperties'; +import { getGroups, getItems } from '@/utilities/_sila/metricProperties'; export default { components: { PageSection, Chart, Collapse }, - mixins: [DataFormatterMixin, TableFilterMixin, LoadingBarMixin], + mixins: [DataFormatterMixin, TableFilterMixin, LoadingBarMixin, BVToastMixin], props: { timeScale: { type: String, @@ -105,9 +105,8 @@ export default { }, data() { return { - warning: 72, - notNormal: 44, - critical: 55, + warning: null, + critical: null, isBusy: true, fields: [ { @@ -144,10 +143,35 @@ export default { }, computed: { + groups() { + return getGroups(this.allSensors); + }, + items() { return getItems(this.allSensors); }, + limits() { + return this.$store.getters['powerSupply/limitsTemp']; + }, + + warningLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + + criticalLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdCritical && this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdCritical; + }, + allSensors() { return this.timeScale === 'hour' ? this.$store.getters['powerSupply/psuTempLastHour'] @@ -171,6 +195,16 @@ export default { this.loadData(); }, methods: { + saveLimit() { + this.startLoader(); + this.$store + .dispatch('powerSupply/patchLimitsTemp', { + warning: this.warning, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, onOpened(state) { if (state) { this.loadData(); @@ -183,9 +217,12 @@ export default { } this.startLoader(); this.$store.dispatch('powerSupply/getPsu', payload).finally(() => { - this.$root.$emit('psu-temp'); - this.isBusy = false; - this.endLoader(); + this.$store.dispatch('powerSupply/getLimitsTemp').finally(() => { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + this.endLoader(); + this.isBusy = false; + }); }); }, }, diff --git a/src/views/_sila/Processors/Dynamic/CpuTemp.vue b/src/views/_sila/Processors/Dynamic/CpuTemp.vue index 60813f9b..e3185aaa 100644 --- a/src/views/_sila/Processors/Dynamic/CpuTemp.vue +++ b/src/views/_sila/Processors/Dynamic/CpuTemp.vue @@ -8,43 +8,42 @@ <img src="@/assets/images/_sila/collapsed/temperature.svg" /> </template> <page-section> - <!-- <b-row class="align-items-end limit-container"> + <b-row class="align-items-end limit-container"> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pageProcessors.labels.notNormal')"> + <b-form-group :label="$t('pageProcessors.labels.warning')"> <b-form-input - v-model="notNormal" + v-model.number="warning" type="number" :min="0" :max="100" - ></b-form-input> - </b-form-group> - </b-col> - <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pageProcessors.labels.critical')"> - <b-form-input v-model="critical" type="number" :min="0" :max="100"> + > </b-form-input> </b-form-group> </b-col> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-form-group :label="$t('pageProcessors.labels.warning')"> - <b-form-input v-model="warning" type="number" :min="0" :max="100"> + <b-form-group :label="$t('pageProcessors.labels.critical')"> + <b-form-input + v-model.number="critical" + type="number" + :min="0" + :max="100" + > </b-form-input> </b-form-group> </b-col> <b-col xs="12" sm="6" xl="3" class="pt-4"> - <b-button variant="primary" style="height: 35px"> + <b-button variant="primary" style="height: 35px" @click="saveLimit"> {{ $t('global.action.save') }} </b-button> </b-col> - </b-row> --> + </b-row> <chart type="processors" :time-scale="timeScale" :data="filteredSensors" :colors="colors" - :warning="+warning" - :not-normal="+notNormal" - :critical="+critical" + :warning="warningLimit" + :critical="criticalLimit" ></chart> <b-table responsive="md" @@ -90,13 +89,14 @@ import PageSection from '@/components/Global/PageSection'; import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; +import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin'; import Collapse from '@/components/_sila/Global/Collapse'; -import { getItems } from '@/utilities/_sila/metricProperties'; +import { getGroups, getItems } from '@/utilities/_sila/metricProperties'; export default { components: { PageSection, Chart, Collapse }, - mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin], + mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin, BVToastMixin], props: { timeScale: { type: String, @@ -105,9 +105,8 @@ export default { }, data() { return { - warning: 72, - notNormal: 44, - critical: 55, + warning: null, + critical: null, isBusy: true, fields: [ { @@ -144,10 +143,35 @@ export default { }, computed: { + groups() { + return getGroups(this.filteredSensors); + }, + items() { return getItems(this.filteredSensors); }, + limits() { + return this.$store.getters['processors/limitsTemp']; + }, + + warningLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdNonCritical && + this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdNonCritical; + }, + + criticalLimit() { + return this.limits.find((limit) => { + return ( + limit?.UpperThresholdCritical && this.groups.includes(limit.MemberId) + ); + })?.UpperThresholdCritical; + }, + allSensors() { return this.timeScale === 'hour' ? this.$store.getters['processors/cpuTempLastHour'] @@ -176,6 +200,16 @@ export default { this.loadData(); }, methods: { + saveLimit() { + this.startLoader(); + this.$store + .dispatch('processors/patchLimitsTemp', { + warning: this.warning, + groups: this.groups, + }) + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); + }, onOpened(state) { if (state) { this.loadData(); @@ -192,8 +226,12 @@ export default { this.$store .dispatch('processors/getCpuTempDynamic', payload) .finally(() => { - this.endLoader(); - this.isBusy = false; + this.$store.dispatch('processors/getLimitsTemp').finally(() => { + this.warning = this.warningLimit; + this.critical = this.criticalLimit; + this.endLoader(); + this.isBusy = false; + }); }); }, }, |