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 | |
parent | f82723a6720ebda943e882f3ef3f297e2f416a38 (diff) | |
download | webui-vue-c978553bdaf95a5f5120456bbb5e56cb53120d8f.tar.xz |
add requests for pci page
-rw-r--r-- | src/locales/en-US.json | 4 | ||||
-rw-r--r-- | src/locales/ru-RU.json | 4 | ||||
-rw-r--r-- | src/store/modules/HardwareStatus/PciStore.js | 35 | ||||
-rw-r--r-- | src/views/_sila/PciDevices/PciDevices.vue | 23 |
4 files changed, 59 insertions, 7 deletions
diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 7b86a298..c6f209c4 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -1109,7 +1109,9 @@ "name": "Name", "type": "Type", "model": "Model", - "manufacturer": "Manufacturer" + "manufacturer": "Manufacturer", + "classCode": "Class Code", + "deviceClass": "Device Class" } }, "countries": { diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 24f447a7..621ef62e 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -1109,7 +1109,9 @@ "name": "Имя устройства", "type": "Тип устройства", "model": "Модель", - "manufacturer": "Производитель" + "manufacturer": "Производитель", + "classCode": "Код класса", + "deviceClass": "Класс девайса" } }, "countries": { 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)); + }, }, }; diff --git a/src/views/_sila/PciDevices/PciDevices.vue b/src/views/_sila/PciDevices/PciDevices.vue index 76453a3a..77f40b66 100644 --- a/src/views/_sila/PciDevices/PciDevices.vue +++ b/src/views/_sila/PciDevices/PciDevices.vue @@ -51,6 +51,16 @@ export default { label: this.$t('pagePci.table.manufacturer'), formatter: this.dataFormatter, }, + { + key: 'classCode', + label: this.$t('pagePci.table.classCode'), + formatter: this.dataFormatter, + }, + { + key: 'deviceClass', + label: this.$t('pagePci.table.deviceClass'), + formatter: this.dataFormatter, + }, ], }; }, @@ -63,10 +73,15 @@ export default { created() { this.startLoader(); - this.$store.dispatch('pci/getDevices').finally(() => { - this.endLoader(); - this.isBusy = false; - }); + this.$store + .dispatch('pci/getDevices') + .then(() => { + this.$store.dispatch('pci/getFunctionDevices'); + }) + .finally(() => { + this.endLoader(); + this.isBusy = false; + }); }, }; </script> |