diff options
author | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-12 16:32:04 +0300 |
---|---|---|
committer | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-12 16:32:04 +0300 |
commit | db29a8672f6737a3b112b22db53fae3366c67097 (patch) | |
tree | 539a30a46c870fc75208f72521ae6813b426bf3d | |
parent | 162e0d338f5423662829e6d9784186a362a19832 (diff) | |
download | webui-vue-db29a8672f6737a3b112b22db53fae3366c67097.tar.xz |
add PCI-devices page
-rw-r--r-- | src/env/components/AppNavigation/sila.js | 5 | ||||
-rw-r--r-- | src/env/router/sila.js | 10 | ||||
-rw-r--r-- | src/locales/en-US.json | 16 | ||||
-rw-r--r-- | src/locales/ru-RU.json | 16 | ||||
-rw-r--r-- | src/store/index.js | 2 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/PciStore.js | 44 | ||||
-rw-r--r-- | src/views/_sila/PciDevices/PciDevices.vue | 72 | ||||
-rw-r--r-- | src/views/_sila/PciDevices/index.js | 2 |
8 files changed, 163 insertions, 4 deletions
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 = [ @@ -335,6 +337,14 @@ const routes = [ }, }, { + path: '/pci-devices', + name: 'pci-devices', + component: PciDevices, + meta: { + title: i18n.t('appPageTitle.pciDevices'), + }, + }, + { path: '*', name: 'page-not-found', component: PageNotFound, 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 @@ +<template> + <b-container fluid="xl"> + <page-title /> + <page-section :section-title="$t('pagePci.title')"> + <b-table + responsive="md" + show-empty + hover + :items="items" + :fields="fields" + :empty-text="$t('global.table.emptyMessage')" + :busy="isBusy" + > + </b-table> + </page-section> + </b-container> +</template> + +<script> +import PageTitle from '@/components/_sila/Global/PageTitle'; +import PageSection from '@/components/_sila/Global/PageSection'; + +import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; +import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; + +export default { + components: { PageTitle, PageSection }, + mixins: [DataFormatterMixin, LoadingBarMixin], + data() { + return { + isBusy: true, + fields: [ + { + key: 'id', + label: this.$t('pagePci.table.id'), + formatter: this.dataFormatter, + tdClass: 'text-nowrap', + }, + { + key: 'name', + label: this.$t('pagePci.table.name'), + formatter: this.dataFormatter, + }, + { + key: 'type', + label: this.$t('pagePci.table.type'), + formatter: this.dataFormatter, + }, + { + key: 'manufacturer', + label: this.$t('pagePci.table.manufacturer'), + formatter: this.dataFormatter, + }, + ], + }; + }, + + computed: { + items() { + return this.$store.getters['pci/pciDevices']; + }, + }, + + created() { + this.startLoader(); + this.$store.dispatch('pci/getDevices').finally(() => { + this.endLoader(); + this.isBusy = false; + }); + }, +}; +</script> 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; |