summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Zakharov <m.zakharov@IBS.RU>2022-08-31 16:39:51 +0300
committerMaksim Zakharov <m.zakharov@IBS.RU>2022-08-31 16:39:51 +0300
commitb79c36cf0c271313e4ae5f2d223fc25505f202c7 (patch)
tree7f5df4fba3413d2734f66a37d1bd884b49abbb40
parentdfc9ebca8098af82994ca6fc8067cc4f8fad5e18 (diff)
downloadwebui-vue-b79c36cf0c271313e4ae5f2d223fc25505f202c7.tar.xz
add comments for pci
-rw-r--r--src/store/modules/HardwareStatus/PciStore.js6
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']));