added an 'About Port Forwarding' notification

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann committed 2021-11-05 11:08:50 -04:00
1 parent 7dd64246dd
commit 3302bc69c7
5 files changed
+87 -4

No files matched your search

@@ -28,7 +28,7 @@ import { observable, makeObservable, reaction } from "mobx";
import { cssNames } from "../../utils";
import { Notifications } from "../notifications";
import { Button } from "../button";
import { addPortForward, getPortForward, openPortForward, PortForwardDialog, portForwardStore, predictProtocol, removePortForward } from "../../port-forward";
import { aboutPortForwarding, addPortForward, getPortForward, getPortForwards, openPortForward, PortForwardDialog, portForwardStore, predictProtocol, removePortForward } from "../../port-forward";
import type { ForwardedPort } from "../../port-forward";
import { Spinner } from "../spinner";
@@ -96,6 +96,9 @@ export class PodContainerPort extends React.Component<Props> {
this.waiting = true;
// determine how many port-forwards are already active
const { length } = await getPortForwards();
try {
this.forwardPort = await addPortForward(portForward);
@@ -103,6 +106,11 @@ export class PodContainerPort extends React.Component<Props> {
portForward.forwardPort = this.forwardPort;
openPortForward(portForward);
this.isPortForwarded = true;
// if this is the first port-forward show the about notification
if (!length) {
aboutPortForwarding();
}
}
} catch (error) {
Notifications.error(`Error occurred starting port-forward, the local port may not be available or the ${portForward.kind} ${portForward.name} may not be reachable`);