From 6e09dd79705f941a91a4ff094fbddda831492216 Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Fri, 19 Aug 2022 16:31:49 +0300 Subject: refactor pci store --- src/locales/ru-RU.json | 2 +- src/store/modules/HardwareStatus/PciStore.js | 15 ++++++--------- .../_sila/Overview/Inventory/InventoryPciDevices.vue | 5 +---- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 98c6d6c3..08152b73 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -1109,7 +1109,7 @@ "table": { "id": "Идентификатор", "health": "Состояние", - "health_d": "Работоспособен", + "health_d": "OK", "name": "Имя", "type": "Тип устройства", "class": "Класс устройства", diff --git a/src/store/modules/HardwareStatus/PciStore.js b/src/store/modules/HardwareStatus/PciStore.js index e49e452c..538b783f 100644 --- a/src/store/modules/HardwareStatus/PciStore.js +++ b/src/store/modules/HardwareStatus/PciStore.js @@ -101,18 +101,15 @@ const PciStore = { return Promise.allSettled(Members) .then((response) => { commit('setPciDevisesMembers', response); + const Functions = response + .map((item) => item.value.data.Members) + .flat(Infinity) + .map((item) => api.get(item['@odata.id'])); + return Promise.allSettled(Functions); }) + .then((response) => commit('setFunctionDevices', response)) .catch((error) => console.log(error)); }, - async getFunctionDevices({ commit, state }) { - const Functions = state.pci - .map((item) => item.Members) - .flat(Infinity) - .map((item) => api.get(item['@odata.id'])); - return Promise.allSettled(Functions).then((response) => - commit('setFunctionDevices', response) - ); - }, }, }; diff --git a/src/views/_sila/Overview/Inventory/InventoryPciDevices.vue b/src/views/_sila/Overview/Inventory/InventoryPciDevices.vue index ff1255ce..91e131de 100644 --- a/src/views/_sila/Overview/Inventory/InventoryPciDevices.vue +++ b/src/views/_sila/Overview/Inventory/InventoryPciDevices.vue @@ -130,10 +130,7 @@ export default { return this.$store .dispatch('pci/getDevices') .then(() => { - return this.$store.dispatch('pci/getDevicesMembers'); - }) - .then(() => { - this.$store.dispatch('pci/getFunctionDevices'); + this.$store.dispatch('pci/getDevicesMembers'); }) .finally(() => { this.$root.$emit('hardware-status-pci-complete'); -- cgit v1.2.3