1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/port-forward/port-forward-notify.tsx
Janne Savolainen 589472c2b5
Shorten license header to reduce amount of clutter in top of the files (#4709)
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
2022-01-18 10:18:10 +02:00

74 lines
1.9 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import React from "react";
import { portForwardsURL } from "../../common/routes/port-forwards";
import { Button } from "../components/button";
import { Notifications, notificationsStore } from "../components/notifications";
import { navigate } from "../navigation";
import { getHostedClusterId } from "../utils";
export function aboutPortForwarding() {
const notificationId = `port-forward-notification-${getHostedClusterId()}`;
Notifications.info(
(
<div className="flex column gaps">
<b>Port Forwarding</b>
<p>
You can manage your port forwards on the Port Forwarding Page.
</p>
<div className="flex gaps row align-left box grow">
<Button
active
outlined
label="Go to Port Forwarding"
onClick={() => {
navigate(portForwardsURL());
notificationsStore.remove(notificationId);
}}
/>
</div>
</div>
),
{
id: notificationId,
timeout: 10_000,
},
);
}
export function notifyErrorPortForwarding(msg: string) {
const notificationId = `port-forward-error-notification-${getHostedClusterId()}`;
Notifications.error(
(
<div className="flex column gaps">
<b>Port Forwarding</b>
<p>
{msg}
</p>
<div className="flex gaps row align-left box grow">
<Button
active
outlined
label="Check Port Forwarding"
onClick={() => {
navigate(portForwardsURL());
notificationsStore.remove(notificationId);
}}
/>
</div>
</div>
),
{
id: notificationId,
timeout: 10_000,
},
);
}