From 61657800f556ebbb1e6041d5d85a99368b73ff3b Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Tue, 19 Jul 2022 18:39:57 +0300 Subject: SILABMC-52 Add page Fans Static, Fans Store, tab Fans --- src/env/components/AppNavigation/sila.js | 11 +++ src/env/router/sila.js | 9 +++ src/locales/en-US.json | 17 ++++- src/locales/ru-RU.json | 17 ++++- src/store/index.js | 2 +- src/store/modules/_sila/HardwareStatus/FanStore.js | 53 ++++++++++++++ src/utilities/_sila/tableParser.js | 12 ++++ src/views/_sila/Fans/Static/FansStaticPage.vue | 81 ++++++++++++++++++++++ src/views/_sila/Fans/Static/index.js | 2 + 9 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 src/store/modules/_sila/HardwareStatus/FanStore.js create mode 100644 src/utilities/_sila/tableParser.js create mode 100644 src/views/_sila/Fans/Static/FansStaticPage.vue create mode 100644 src/views/_sila/Fans/Static/index.js diff --git a/src/env/components/AppNavigation/sila.js b/src/env/components/AppNavigation/sila.js index bf7f0748..251ddf96 100644 --- a/src/env/components/AppNavigation/sila.js +++ b/src/env/components/AppNavigation/sila.js @@ -77,6 +77,17 @@ const AppNavigationMixin = { }, ], }, + { + id: 'fans', + label: this.$t('appNavigation.fans'), + children: [ + { + id: 'fans/static', + label: this.$t('appNavigation.staticInfo'), + route: '/fans/static', + }, + ], + }, { id: 'operations', label: this.$t('appNavigation.operations'), diff --git a/src/env/router/sila.js b/src/env/router/sila.js index a622a436..8a489585 100644 --- a/src/env/router/sila.js +++ b/src/env/router/sila.js @@ -29,6 +29,7 @@ import KeyClear from '@/views/_sila/Operations/KeyClear'; import Certificates from '@/views/_sila/SecurityAndAccess/Certificates'; import VirtualMedia from '@/views/_sila/Operations/VirtualMedia'; import Power from '@/views/_sila/ResourceManagement/Power'; +import FansStatic from '@/views/_sila/Fans/Static'; import i18n from '@/i18n'; const routes = [ @@ -151,6 +152,14 @@ const routes = [ title: i18n.t('appPageTitle.sensors'), }, }, + { + path: 'fans/static', + name: 'fans-static', + component: FansStatic, + meta: { + title: i18n.t('appPageTitle.fans'), + }, + }, { path: '/security-and-access/sessions', name: 'sessions', diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 6e1f6f76..52994204 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -128,7 +128,9 @@ "certificates": "@:appPageTitle.certificates", "virtualMedia": "@:appPageTitle.virtualMedia", "power": "@:appPageTitle.power", - "keyClear": "@:appPageTitle.keyClear" + "keyClear": "@:appPageTitle.keyClear", + "staticInfo": "Static Information", + "fans": "@:appPageTitle.fans" }, "appPageTitle": { "changePassword": "Change password", @@ -138,6 +140,7 @@ "dumps": "Dumps", "eventLogs": "Event logs", "factoryReset": "Factory reset", + "fans": "Fans", "firmware": "Firmware", "inventory": "Inventory and LEDs", "kvm": "KVM", @@ -157,7 +160,8 @@ "serverPowerOperations": "Server power operations", "certificates": "Certificates", "virtualMedia": "Virtual media", - "keyClear": "Key clear" + "keyClear": "Key clear", + "specification": "Specification" }, "pageChangePassword": { "changePassword": "Change password", @@ -811,6 +815,15 @@ "upperCritical": "Upper critical" } }, + "pageFans": { + "installedFans": "Installed Fans", + "table": { + "name": "Name", + "health": "Health", + "type": "Type", + "currentValue": "Current Speed, rpm" + } + }, "pageSerialOverLan": { "alert": { "disconnectedAlertMessage" : "System must be powered on to connect" diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 97016f8a..471da146 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -131,7 +131,9 @@ "certificates": "@:appPageTitle.certificates", "virtualMedia": "@:appPageTitle.virtualMedia", "power": "@:appPageTitle.power", - "keyClear": "@:appPageTitle.keyClear" + "keyClear": "@:appPageTitle.keyClear", + "staticInfo": "Статическая информация", + "fans": "@:appPageTitle.fans" }, "appPageTitle": { "changePassword": "Изменить пароль", @@ -141,6 +143,7 @@ "dumps": "Дампы", "eventLogs": "Журнал событий", "factoryReset": "Сброс до заводских настроек", + "fans": "Вентиляторы", "firmware": "Встроенное ПО", "inventory": "Перечень оборудования и LED", "kvm": "KVM", @@ -160,7 +163,8 @@ "serverPowerOperations": "Управление питанием сервера", "certificates": "Сертификаты", "virtualMedia": "Виртуальные носители", - "keyClear": "Удаление ключей" + "keyClear": "Удаление ключей", + "specification": "Характеристики" }, "pageChangePassword": { "changePassword": "Изменить пароль", @@ -815,6 +819,15 @@ "upperCritical": "Макс. крит. значение" } }, + "pageFans": { + "installedFans": "Установленные вентиляторы", + "table": { + "name": "Имя", + "health": "Состояние", + "type": "Тип устройства", + "currentValue": "Текущая скорость, об/мин" + } + }, "pageSerialOverLan": { "alert": { "disconnectedAlertMessage" : "Система должна быть включена для соединения" diff --git a/src/store/index.js b/src/store/index.js index ba248c58..41eba75f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -19,7 +19,7 @@ import ServerLedStore from './modules/HardwareStatus/ServerLedStore'; import SystemStore from './modules/HardwareStatus/SystemStore'; import PowerSupplyStore from './modules/HardwareStatus/PowerSupplyStore'; import MemoryStore from './modules/HardwareStatus/MemoryStore'; -import FanStore from './modules/HardwareStatus/FanStore'; +import FanStore from './modules/_sila//HardwareStatus/FanStore'; import ChassisStore from './modules/HardwareStatus/ChassisStore'; import BmcStore from './modules/HardwareStatus/BmcStore'; import ProcessorStore from './modules/HardwareStatus/ProcessorStore'; diff --git a/src/store/modules/_sila/HardwareStatus/FanStore.js b/src/store/modules/_sila/HardwareStatus/FanStore.js new file mode 100644 index 00000000..1399710b --- /dev/null +++ b/src/store/modules/_sila/HardwareStatus/FanStore.js @@ -0,0 +1,53 @@ +import api from '@/store/api'; +import { fanType } from '@/utilities/_sila/tableParser'; + +const FanStore = { + namespaced: true, + state: { + fans: [], + }, + getters: { + fans: (state) => state.fans, + }, + mutations: { + setFanInfo: (state, data) => { + state.fans = data.map((fan) => { + const { + IndicatorLED, + Location, + MemberId, + Name, + Reading, + ReadingUnits, + Status = {}, + PartNumber, + SerialNumber, + } = fan; + return { + id: MemberId, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + healthRollup: Status.HealthRollup, + identifyLed: IndicatorLED, + locationNumber: Location, + name: Name, + speed: Reading + ' ' + ReadingUnits, + speedRPM: Reading, + type: fanType(Name), + statusState: Status.State, + }; + }); + }, + }, + actions: { + async getFanInfo({ commit }) { + return await api + .get('/redfish/v1/Chassis/chassis/Thermal') + .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans)) + .catch((error) => console.log(error)); + }, + }, +}; + +export default FanStore; diff --git a/src/utilities/_sila/tableParser.js b/src/utilities/_sila/tableParser.js new file mode 100644 index 00000000..9c85bfe5 --- /dev/null +++ b/src/utilities/_sila/tableParser.js @@ -0,0 +1,12 @@ +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 new file mode 100644 index 00000000..810aeb4b --- /dev/null +++ b/src/views/_sila/Fans/Static/FansStaticPage.vue @@ -0,0 +1,81 @@ + + + diff --git a/src/views/_sila/Fans/Static/index.js b/src/views/_sila/Fans/Static/index.js new file mode 100644 index 00000000..9a5d913d --- /dev/null +++ b/src/views/_sila/Fans/Static/index.js @@ -0,0 +1,2 @@ +import FansStaticPage from './FansStaticPage.vue'; +export default FansStaticPage; -- cgit v1.2.3