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