mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge remote-tracking branch 'origin/master' into eliminate-gst-from-app-paths
This commit is contained in:
8 files changed
+29
-86
No files matched your search
@@ -48,31 +48,18 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
|
||||
|
||||
const savedPortForwards = this.dependencies.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(this.add),
|
||||
);
|
||||
await Promise.all(savedPortForwards.filter(pf => pf.status === "Disabled").map(this.add));
|
||||
|
||||
// add the active ones and check if they started successfully
|
||||
const results = await Promise.allSettled(
|
||||
savedPortForwards
|
||||
.filter((pf) => pf.status === "Active")
|
||||
.map(this.add),
|
||||
);
|
||||
// add the active ones (assume active if the status is undefined, for backward compatibility) and check if they started successfully
|
||||
const results = await Promise.allSettled(savedPortForwards.filter(pf => !pf.status || pf.status === "Active").map(this.add));
|
||||
|
||||
for (const result of results) {
|
||||
if (
|
||||
result.status === "rejected" ||
|
||||
result.value.status === "Disabled"
|
||||
) {
|
||||
notifyErrorPortForwarding(
|
||||
"One or more port-forwards could not be started",
|
||||
);
|
||||
if (result.status === "rejected" || result.value.status === "Disabled") {
|
||||
notifyErrorPortForwarding("One or more port-forwards could not be started");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user