diff options
author | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-18 10:24:36 +0300 |
---|---|---|
committer | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-08-18 10:24:36 +0300 |
commit | c978553bdaf95a5f5120456bbb5e56cb53120d8f (patch) | |
tree | 86e10a26c23af51b5214e278013223b6ae09f0af /src/store/modules/HardwareStatus | |
parent | f82723a6720ebda943e882f3ef3f297e2f416a38 (diff) | |
download | webui-vue-c978553bdaf95a5f5120456bbb5e56cb53120d8f.tar.xz |
add requests for pci page
Diffstat (limited to 'src/store/modules/HardwareStatus')
-rw-r--r-- | src/store/modules/HardwareStatus/PciStore.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/store/modules/HardwareStatus/PciStore.js b/src/store/modules/HardwareStatus/PciStore.js index ae72ce12..baeaaadf 100644 --- a/src/store/modules/HardwareStatus/PciStore.js +++ b/src/store/modules/HardwareStatus/PciStore.js @@ -13,7 +13,7 @@ const PciStore = { state.pci = data.map((item) => { const { value: { - data: { Id, Name, Manufacturer, DeviceType }, + data: { Id, Name, Manufacturer, DeviceType, PCIeFunctions }, }, } = item; return { @@ -21,6 +21,23 @@ const PciStore = { name: Name, type: DeviceType, manufacturer: Manufacturer, + PCIeFunction: PCIeFunctions, + }; + }); + }, + setSecondPciDevises: (state, data) => { + state.pci = data.map((item, index) => { + const { + value: { + data: { ClassCode, DeviceClass, DeviceId, FunctionType }, + }, + } = item; + return { + ...state.pci[index], + classCode: ClassCode, + deviceClass: DeviceClass, + deviceId: DeviceId, + functionType: FunctionType, }; }); }, @@ -38,6 +55,22 @@ const PciStore = { }) .catch((error) => console.log(error)); }, + async getFunctionDevices({ commit, state }) { + const functions = state.pci.map((item) => + api.get(item.PCIeFunction['@odata.id']) + ); + Promise.allSettled(functions) + .then((response) => { + const data = response.map((item) => + api.get(item.value.data.Members[0]['@odata.id']) + ); + return Promise.allSettled(data); + }) + .then((response) => { + commit('setSecondPciDevises', response); + }) + .catch((error) => console.log(error)); + }, }, }; |