summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus
diff options
context:
space:
mode:
authorMaksim Zakharov <m.zakharov@IBS.RU>2022-08-12 16:32:04 +0300
committerMaksim Zakharov <m.zakharov@IBS.RU>2022-08-12 16:32:04 +0300
commitdb29a8672f6737a3b112b22db53fae3366c67097 (patch)
tree539a30a46c870fc75208f72521ae6813b426bf3d /src/store/modules/HardwareStatus
parent162e0d338f5423662829e6d9784186a362a19832 (diff)
downloadwebui-vue-db29a8672f6737a3b112b22db53fae3366c67097.tar.xz
add PCI-devices page
Diffstat (limited to 'src/store/modules/HardwareStatus')
-rw-r--r--src/store/modules/HardwareStatus/PciStore.js44
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;