fix associate floating IP in the port list if allowed
Show Associate Floating IP in port list if allowed Closes-Bug: #1991078 Change-Id: I100b2bc184bb8e3e861cfd6437745ab799ca02da
This commit is contained in:
parent
cd72ae0ae1
commit
a92c6aa9ce
@ -174,28 +174,37 @@ export class PortStore extends Base {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const { subnetId } = filters;
|
const { subnetId } = filters;
|
||||||
if (!subnetId) {
|
if (subnetId) {
|
||||||
return items;
|
const newItems = [];
|
||||||
|
items.forEach((it) => {
|
||||||
|
const { fixed_ips = [] } = it;
|
||||||
|
const newFixedIps = fixed_ips.filter((ip) => ip.subnet_id === subnetId);
|
||||||
|
if (newFixedIps.length) {
|
||||||
|
const ipv4 = it.ipv4.filter((ip) =>
|
||||||
|
newFixedIps.some((newIp) => newIp.ip_address === ip)
|
||||||
|
);
|
||||||
|
const ipv6 = it.ipv6.filter((ip) =>
|
||||||
|
newFixedIps.some((newIp) => newIp.ip_address === ip)
|
||||||
|
);
|
||||||
|
newItems.push({
|
||||||
|
...it,
|
||||||
|
fixed_ips: newFixedIps,
|
||||||
|
ipv4,
|
||||||
|
ipv6,
|
||||||
|
subnet_id: subnetId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newItems;
|
||||||
}
|
}
|
||||||
const newItems = [];
|
const fips = (await globalFloatingIpsStore.pureFetchList()) || [];
|
||||||
items.forEach((it) => {
|
const newItems = items.map((it) => {
|
||||||
const { fixed_ips = [] } = it;
|
it.associatedDetail = fips.filter(
|
||||||
const newFixedIps = fixed_ips.filter((ip) => ip.subnet_id === subnetId);
|
(f) =>
|
||||||
if (newFixedIps.length) {
|
f.port_id === it.id &&
|
||||||
const ipv4 = it.ipv4.filter((ip) =>
|
it.fixed_ips.find((ff) => ff.ip_address === f.fixed_ip_address)
|
||||||
newFixedIps.some((newIp) => newIp.ip_address === ip)
|
);
|
||||||
);
|
return it;
|
||||||
const ipv6 = it.ipv6.filter((ip) =>
|
|
||||||
newFixedIps.some((newIp) => newIp.ip_address === ip)
|
|
||||||
);
|
|
||||||
newItems.push({
|
|
||||||
...it,
|
|
||||||
fixed_ips: newFixedIps,
|
|
||||||
ipv4,
|
|
||||||
ipv6,
|
|
||||||
subnet_id: subnetId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return newItems;
|
return newItems;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user