From db29a8672f6737a3b112b22db53fae3366c67097 Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Fri, 12 Aug 2022 16:32:04 +0300 Subject: add PCI-devices page --- src/env/components/AppNavigation/sila.js | 5 ++ src/env/router/sila.js | 10 ++++ src/locales/en-US.json | 16 ++++++- src/locales/ru-RU.json | 16 ++++++- src/store/index.js | 2 + src/store/modules/HardwareStatus/PciStore.js | 44 +++++++++++++++++ src/views/_sila/PciDevices/PciDevices.vue | 72 ++++++++++++++++++++++++++++ src/views/_sila/PciDevices/index.js | 2 + 8 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 src/store/modules/HardwareStatus/PciStore.js create mode 100644 src/views/_sila/PciDevices/PciDevices.vue create mode 100644 src/views/_sila/PciDevices/index.js diff --git a/src/env/components/AppNavigation/sila.js b/src/env/components/AppNavigation/sila.js index 50aaf996..401812a7 100644 --- a/src/env/components/AppNavigation/sila.js +++ b/src/env/components/AppNavigation/sila.js @@ -225,6 +225,11 @@ const AppNavigationMixin = { }, ], }, + { + id: 'pci-devices', + label: this.$t('appNavigation.pciDevices'), + route: '/pci-devices', + }, ], }; }, diff --git a/src/env/router/sila.js b/src/env/router/sila.js index e9d238b0..539f3c16 100644 --- a/src/env/router/sila.js +++ b/src/env/router/sila.js @@ -36,6 +36,8 @@ import FansDynamic from '@/views/_sila/Fans/Dynamic'; import MotherboardDynamic from '@/views/_sila/Motherboard/Dynamic'; import PowerStatic from '@/views/_sila/Power/Static'; import PowerDynamic from '@/views/_sila/Power/Dynamic'; +import PciDevices from '@/views/_sila/PciDevices'; + import i18n from '@/i18n'; const routes = [ @@ -334,6 +336,14 @@ const routes = [ title: i18n.t('appPageTitle.virtualMedia'), }, }, + { + path: '/pci-devices', + name: 'pci-devices', + component: PciDevices, + meta: { + title: i18n.t('appPageTitle.pciDevices'), + }, + }, { path: '*', name: 'page-not-found', diff --git a/src/locales/en-US.json b/src/locales/en-US.json index abbc8932..ffede398 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -151,7 +151,8 @@ "fans": "@:appPageTitle.fans", "processors": "@:appPageTitle.processors", "memory": "@:appPageTitle.memory", - "motherboard": "@:appPageTitle.motherboard" + "motherboard": "@:appPageTitle.motherboard", + "pciDevices": "@:appPageTitle.pciDevices" }, "appPageTitle": { "changePassword": "Change password", @@ -187,7 +188,8 @@ "certificates": "Certificates", "virtualMedia": "Virtual media", "keyClear": "Key clear", - "specification": "Specification" + "specification": "Specification", + "pciDevices": "PCI-devices" }, "pageChangePassword": { "changePassword": "Change password", @@ -1086,6 +1088,16 @@ "serverClosedWithErrors": "Server closed with errors" } }, + "pagePci": { + "title": "Installed PCI-devices", + "table": { + "id": "ID", + "name": "Name", + "type": "Type", + "model": "Model", + "manufacturer": "Manufacturer" + } + }, "countries": { "AF": "Afghanistan", "AL": "Albania", diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 19e34b9e..47059163 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -151,7 +151,8 @@ "fans": "@:appPageTitle.fans", "processors": "@:appPageTitle.processors", "memory": "@:appPageTitle.memory", - "motherboard": "@:appPageTitle.motherboard" + "motherboard": "@:appPageTitle.motherboard", + "pciDevices": "@:appPageTitle.pciDevices" }, "appPageTitle": { "changePassword": "Изменить пароль", @@ -187,7 +188,8 @@ "certificates": "Сертификаты", "virtualMedia": "Виртуальные носители", "keyClear": "Удаление ключей", - "specification": "Характеристики" + "specification": "Характеристики", + "pciDevices": "PCI-устройства" }, "pageChangePassword": { "changePassword": "Изменить пароль", @@ -1086,6 +1088,16 @@ "serverClosedWithErrors": "Соединение разорвано" } }, + "pagePci": { + "title": "Установленые PCI-устройства", + "table": { + "id": "Идентификатор", + "name": "Имя устройства", + "type": "Тип устройства", + "model": "Модель", + "manufacturer": "Производитель" + } + }, "countries": { "AF": "Афганистан", "AL": "Албания", diff --git a/src/store/index.js b/src/store/index.js index fb911a40..c12f1358 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -29,6 +29,7 @@ import PostCodeLogsStore from './modules/Logs/PostCodeLogsStore'; import PoliciesStore from './modules/SecurityAndAccess/PoliciesStore'; import FactoryResetStore from './modules/Operations/FactoryResetStore'; import KeyClearStore from './modules/Operations/KeyClearStore'; +import PciStore from './modules/HardwareStatus/PciStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; import DateTimeStore from './modules/Settings/DateTimeStore'; @@ -71,6 +72,7 @@ export default new Vuex.Store({ policies: PoliciesStore, factoryReset: FactoryResetStore, keyClear: KeyClearStore, + pci: PciStore, }, plugins: [WebSocketPlugin], }); diff --git a/src/store/modules/HardwareStatus/PciStore.js b/src/store/modules/HardwareStatus/PciStore.js new file mode 100644 index 00000000..ae72ce12 --- /dev/null +++ b/src/store/modules/HardwareStatus/PciStore.js @@ -0,0 +1,44 @@ +import api from '@/store/api'; + +const PciStore = { + namespaced: true, + state: { + pci: [], + }, + getters: { + pciDevices: (state) => state.pci, + }, + mutations: { + setPciDevises: (state, data) => { + state.pci = data.map((item) => { + const { + value: { + data: { Id, Name, Manufacturer, DeviceType }, + }, + } = item; + return { + id: Id, + name: Name, + type: DeviceType, + manufacturer: Manufacturer, + }; + }); + }, + }, + actions: { + async getDevices({ commit }) { + return await api + .get('/redfish/v1/Systems/system/PCIeDevices') + .then(({ data: { Members = [] } }) => { + const devices = Members.map((item) => api.get(item['@odata.id'])); + return Promise.allSettled(devices); + }) + .then((response) => { + commit('setPciDevises', response); + }) + .catch((error) => console.log(error)); + }, + }, +}; + +export default PciStore; diff --git a/src/views/_sila/PciDevices/PciDevices.vue b/src/views/_sila/PciDevices/PciDevices.vue new file mode 100644 index 00000000..76453a3a --- /dev/null +++ b/src/views/_sila/PciDevices/PciDevices.vue @@ -0,0 +1,72 @@ + + + diff --git a/src/views/_sila/PciDevices/index.js b/src/views/_sila/PciDevices/index.js new file mode 100644 index 00000000..800bd92a --- /dev/null +++ b/src/views/_sila/PciDevices/index.js @@ -0,0 +1,2 @@ +import PciDevices from './PciDevices.vue'; +export default PciDevices; -- cgit v1.2.3