diff options
Diffstat (limited to 'src/store/modules/HardwareStatus')
-rw-r--r-- | src/store/modules/HardwareStatus/PciStore.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/PciStore.js b/src/store/modules/HardwareStatus/PciStore.js index 97817d55..dcc7c175 100644 --- a/src/store/modules/HardwareStatus/PciStore.js +++ b/src/store/modules/HardwareStatus/PciStore.js @@ -85,18 +85,22 @@ const PciStore = { async getDevices({ commit }) { return await api .get('/redfish/v1/Systems/system/PCIeDevices') + // get all pci devices .then(({ data: { Members = [] } }) => { const devices = Members.map((item) => async () => api.get(item['@odata.id']) ); + // create an array of async functions to get all devices return devices; }) .then(async (response) => { + // calling functions one by one to avoid errors const results = []; for (let request of response) { const reponse = await request(); results.push(reponse); } + // return successful requests return Promise.allSettled(results); }) .then((response) => { @@ -105,6 +109,7 @@ const PciStore = { .catch((error) => console.log(error)); }, async getDevicesMembers({ commit, state }) { + // the same logic as in getDevices const Members = state.pci.map((item) => async () => api.get(item.PCIeFunction['@odata.id']) ); @@ -117,6 +122,7 @@ const PciStore = { .then((response) => { commit('setPciDevisesMembers', response); const Functions = response + // can return an array of routes .map((item) => item.value.data.Members) .flat(Infinity) .map((item) => async () => api.get(item['@odata.id'])); |