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 /src/store | |
parent | 162e0d338f5423662829e6d9784186a362a19832 (diff) | |
download | webui-vue-db29a8672f6737a3b112b22db53fae3366c67097.tar.xz |
add PCI-devices page
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/index.js | 2 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/PciStore.js | 44 |
2 files changed, 46 insertions, 0 deletions
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; |