mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
added protocol to the port-forward list and details page. Added the port-forward address to the details page title
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
f70853b95e
commit
1fbd9505f6
@ -23,7 +23,7 @@ import "./port-forward-details.scss";
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import type { PortForwardItem } from "../../port-forward";
|
import { portForwardAddress, PortForwardItem } from "../../port-forward";
|
||||||
import { Drawer, DrawerItem } from "../drawer";
|
import { Drawer, DrawerItem } from "../drawer";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import { podsApi, serviceApi } from "../../../common/k8s-api/endpoints";
|
import { podsApi, serviceApi } from "../../../common/k8s-api/endpoints";
|
||||||
@ -80,6 +80,9 @@ export class PortForwardDetails extends React.Component<Props> {
|
|||||||
<DrawerItem name="Local Port">
|
<DrawerItem name="Local Port">
|
||||||
{portForward.getForwardPort()}
|
{portForward.getForwardPort()}
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
|
<DrawerItem name="Protocol">
|
||||||
|
{portForward.getProtocol()}
|
||||||
|
</DrawerItem>
|
||||||
<DrawerItem name="Status">
|
<DrawerItem name="Status">
|
||||||
<span className={cssNames("status", portForward.getStatus().toLowerCase())}>{portForward.getStatus()}</span>
|
<span className={cssNames("status", portForward.getStatus().toLowerCase())}>{portForward.getStatus()}</span>
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
@ -96,7 +99,7 @@ export class PortForwardDetails extends React.Component<Props> {
|
|||||||
className="PortForwardDetails"
|
className="PortForwardDetails"
|
||||||
usePortal={true}
|
usePortal={true}
|
||||||
open={!!portForward}
|
open={!!portForward}
|
||||||
title="Port Forward"
|
title={`Port Forward: ${portForwardAddress(portForward)}`}
|
||||||
onClose={hideDetails}
|
onClose={hideDetails}
|
||||||
toolbar={toolbar}
|
toolbar={toolbar}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -37,6 +37,7 @@ enum columnId {
|
|||||||
kind = "kind",
|
kind = "kind",
|
||||||
port = "port",
|
port = "port",
|
||||||
forwardPort = "forwardPort",
|
forwardPort = "forwardPort",
|
||||||
|
protocol = "protocol",
|
||||||
status = "status",
|
status = "status",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ export class PortForwards extends React.Component<Props> {
|
|||||||
[columnId.kind]: item => item.getKind(),
|
[columnId.kind]: item => item.getKind(),
|
||||||
[columnId.port]: item => item.getPort(),
|
[columnId.port]: item => item.getPort(),
|
||||||
[columnId.forwardPort]: item => item.getForwardPort(),
|
[columnId.forwardPort]: item => item.getForwardPort(),
|
||||||
|
[columnId.protocol]: item => item.getProtocol(),
|
||||||
[columnId.status]: item => item.getStatus(),
|
[columnId.status]: item => item.getStatus(),
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
@ -114,6 +116,7 @@ export class PortForwards extends React.Component<Props> {
|
|||||||
{ title: "Kind", className: "kind", sortBy: columnId.kind, id: columnId.kind },
|
{ title: "Kind", className: "kind", sortBy: columnId.kind, id: columnId.kind },
|
||||||
{ title: "Pod Port", className: "port", sortBy: columnId.port, id: columnId.port },
|
{ title: "Pod Port", className: "port", sortBy: columnId.port, id: columnId.port },
|
||||||
{ title: "Local Port", className: "forwardPort", sortBy: columnId.forwardPort, id: columnId.forwardPort },
|
{ title: "Local Port", className: "forwardPort", sortBy: columnId.forwardPort, id: columnId.forwardPort },
|
||||||
|
{ title: "Protocol", className: "protocol", sortBy: columnId.protocol, id: columnId.protocol },
|
||||||
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
||||||
]}
|
]}
|
||||||
renderTableContents={item => [
|
renderTableContents={item => [
|
||||||
@ -122,6 +125,7 @@ export class PortForwards extends React.Component<Props> {
|
|||||||
item.getKind(),
|
item.getKind(),
|
||||||
item.getPort(),
|
item.getPort(),
|
||||||
item.getForwardPort(),
|
item.getForwardPort(),
|
||||||
|
item.getProtocol(),
|
||||||
{ title: item.getStatus(), className: item.getStatus().toLowerCase() },
|
{ title: item.getStatus(), className: item.getStatus().toLowerCase() },
|
||||||
]}
|
]}
|
||||||
renderItemMenu={pf => (
|
renderItemMenu={pf => (
|
||||||
|
|||||||
@ -180,8 +180,12 @@ export async function getPortForwards(): Promise<ForwardedPort[]> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function portForwardAddress(portForward: ForwardedPort) {
|
||||||
|
return `${portForward.protocol ?? "http"}://localhost:${portForward.forwardPort}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function openPortForward(portForward: ForwardedPort) {
|
export function openPortForward(portForward: ForwardedPort) {
|
||||||
const browseTo = `${portForward.protocol ?? "http"}://localhost:${portForward.forwardPort}`;
|
const browseTo = portForwardAddress(portForward);
|
||||||
|
|
||||||
openExternal(browseTo)
|
openExternal(browseTo)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user