mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
ensure old, saved port-forwards get loaded (#4668)
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
f7f27a8304
commit
58ffb8e3e4
@ -47,14 +47,14 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
|
||||
|
||||
const savedPortForwards = this.storage.get(); // undefined on first load
|
||||
|
||||
if (Array.isArray(savedPortForwards)) {
|
||||
if (Array.isArray(savedPortForwards) && savedPortForwards.length > 0) {
|
||||
logger.info("[PORT-FORWARD-STORE] starting saved port-forwards");
|
||||
|
||||
// add the disabled ones
|
||||
await Promise.all(savedPortForwards.filter(pf => pf.status === "Disabled").map(addPortForward));
|
||||
|
||||
// add the active ones and check if they started successfully
|
||||
const results = await Promise.allSettled(savedPortForwards.filter(pf => pf.status === "Active").map(addPortForward));
|
||||
// add the active ones (assume active if the status is undefined, for backward compatibilty) and check if they started successfully
|
||||
const results = await Promise.allSettled(savedPortForwards.filter(pf => !pf.status || pf.status === "Active").map(addPortForward));
|
||||
|
||||
for (const result of results) {
|
||||
if (result.status === "rejected" || result.value.status === "Disabled") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user