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:
xusongfu 2022-09-28 16:59:12 +08:00
parent cd72ae0ae1
commit a92c6aa9ce

View File

@ -174,9 +174,7 @@ export class PortStore extends Base {
return items; return items;
} }
const { subnetId } = filters; const { subnetId } = filters;
if (!subnetId) { if (subnetId) {
return items;
}
const newItems = []; const newItems = [];
items.forEach((it) => { items.forEach((it) => {
const { fixed_ips = [] } = it; const { fixed_ips = [] } = it;
@ -199,6 +197,17 @@ export class PortStore extends Base {
}); });
return newItems; return newItems;
} }
const fips = (await globalFloatingIpsStore.pureFetchList()) || [];
const newItems = items.map((it) => {
it.associatedDetail = fips.filter(
(f) =>
f.port_id === it.id &&
it.fixed_ips.find((ff) => ff.ip_address === f.fixed_ip_address)
);
return it;
});
return newItems;
}
} }
const globalPortStore = new PortStore(); const globalPortStore = new PortStore();