1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

M #-: Filter out duplicate PCI devices ()

(cherry picked from commit b32418df0ae7b551193e9d32974af19bc3081946)
This commit is contained in:
vichansson 2023-07-26 18:29:44 +03:00 committed by Tino Vázquez
parent be38316f03
commit 73a9b7931a
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

@ -438,7 +438,16 @@ const HARDWARE_FIELDS = (defaultData = {}) => [
type: INPUT_TYPES.SELECT,
values: () => {
const { data: hosts = [] } = useGetHostsQuery()
const pciDevices = hosts.map(getPciDevices).flat()
const pciDevices = hosts
.map(getPciDevices)
.flat()
.reduce(
(currentPCIS, newDevice) =>
currentPCIS.some((pci) => pci.ADDRESS === newDevice.ADDRESS) // Filter out devices with the same address
? currentPCIS
: [...currentPCIS, newDevice],
[]
)
return arrayToOptions(pciDevices, {
getText: ({ DEVICE_NAME } = {}) => DEVICE_NAME,