diff options
Diffstat (limited to 'src/store')
-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)); + }, }, }; |