From 5fff754d48ec658673c11f8e593d3af4f94d79df Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Tue, 9 Aug 2022 13:56:56 +0300 Subject: fx type fields for fans, static --- src/locales/en-US.json | 4 ++++ src/locales/ru-RU.json | 4 ++++ src/store/modules/HardwareStatus/FanStore.js | 2 -- src/utilities/_sila/tableParser.js | 12 ------------ src/views/_sila/Fans/Static/FansStaticPage.vue | 22 ++++++++++++++++++++++ 5 files changed, 30 insertions(+), 14 deletions(-) delete mode 100644 src/utilities/_sila/tableParser.js (limited to 'src') diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 8b807b6c..abbc8932 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -865,6 +865,10 @@ "pwm": "% power", "currentValue": "Current Speed, rpm" }, + "types": { + "processors": "Processors", + "motherboard": "Motherboard" + }, "labels": { "warning": "Warning value, rpm", "shutdown": "Failure value, rpm" diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 6baeb179..19e34b9e 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -865,6 +865,10 @@ "pwm": "% мощности", "currentValue": "Current Speed, rpm" }, + "types": { + "processors": "Процессоры", + "motherboard": "Системная плата" + }, "labels": { "warning": "Значение предупреждения, об/мин", "shutdown": "Значение отказа, об/мин" diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js index e58296b5..26c20254 100644 --- a/src/store/modules/HardwareStatus/FanStore.js +++ b/src/store/modules/HardwareStatus/FanStore.js @@ -1,5 +1,4 @@ import api from '@/store/api'; -import { fanType } from '@/utilities/_sila/tableParser'; const FanStore = { namespaced: true, @@ -36,7 +35,6 @@ const FanStore = { name: Name, speed: Reading + ' ' + ReadingUnits, speedRPM: Reading, - type: fanType(Name), statusState: Status.State, }; }); diff --git a/src/utilities/_sila/tableParser.js b/src/utilities/_sila/tableParser.js deleted file mode 100644 index 9c85bfe5..00000000 --- a/src/utilities/_sila/tableParser.js +++ /dev/null @@ -1,12 +0,0 @@ -export function fanType(name) { - switch (true) { - case name.includes('CPU'): - return 'Процессоры'; - case name.includes('System'): - return 'Системная плата'; - case name.includes('Pwm'): - return 'Процессоры'; - default: - return 'Неизвестное расположение'; - } -} diff --git a/src/views/_sila/Fans/Static/FansStaticPage.vue b/src/views/_sila/Fans/Static/FansStaticPage.vue index dba6edb1..d92fb888 100644 --- a/src/views/_sila/Fans/Static/FansStaticPage.vue +++ b/src/views/_sila/Fans/Static/FansStaticPage.vue @@ -67,6 +67,14 @@ export default { computed: { fans() { + return this.rawFans.map((fan) => { + return { + type: this.getFanTypeByName(fan.name), + ...fan, + }; + }); + }, + rawFans() { return this.$store.getters['fan/fans']; }, }, @@ -78,5 +86,19 @@ export default { this.isBusy = false; }); }, + + methods: { + getFanTypeByName(name) { + switch (true) { + case name.includes('CPU'): + case name.includes('Pwm'): + return this.$t('pageFans.types.processors'); + case name.includes('System'): + return this.$t('pageFans.types.motherboard'); + default: + return null; + } + }, + }, }; -- cgit v1.2.3