mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
removed unimplemented forwarded port details page,modified logging
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
7b15a5526c
commit
0058e9f0e2
@ -20,4 +20,3 @@
|
||||
*/
|
||||
|
||||
export * from "./port-forwards";
|
||||
export * from "./port-forward-details";
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
.PortForwardDetails {
|
||||
.SubTitle {
|
||||
text-transform: none
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import "./port-forward-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { PortForwardItem } from "../../port-forward";
|
||||
|
||||
interface Props {
|
||||
portForward: PortForwardItem;
|
||||
hideDetails(): void;
|
||||
}
|
||||
|
||||
@observer
|
||||
export class PortForwardDetails extends React.Component<Props> {
|
||||
render() {
|
||||
return (
|
||||
<div className="PortForwardDetails">
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -23,12 +23,8 @@ import "./port-forwards.scss";
|
||||
|
||||
import React from "react";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import type { RouteComponentProps } from "react-router-dom";
|
||||
import { ItemListLayout } from "../item-object-list/item-list-layout";
|
||||
import { PortForwardItem, portForwardStore } from "../../port-forward";
|
||||
import { PortForwardsRouteParams, portForwardsURL } from "../../../common/routes";
|
||||
import { navigation } from "../../navigation";
|
||||
import { PortForwardDetails } from "./port-forward-details";
|
||||
import { PortForwardMenu } from "./port-forward-menu";
|
||||
|
||||
enum columnId {
|
||||
@ -39,11 +35,8 @@ enum columnId {
|
||||
forwardPort = "forwardPort",
|
||||
}
|
||||
|
||||
interface Props extends RouteComponentProps<PortForwardsRouteParams> {
|
||||
}
|
||||
|
||||
@observer
|
||||
export class PortForwards extends React.Component<Props> {
|
||||
export class PortForwards extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
disposeOnUnmount(this, [
|
||||
@ -51,26 +44,6 @@ export class PortForwards extends React.Component<Props> {
|
||||
]);
|
||||
}
|
||||
|
||||
get selectedPortForward() {
|
||||
const { match: { params: { forwardport } } } = this.props;
|
||||
|
||||
return portForwardStore.items.find(pf => {
|
||||
return pf.getForwardPort() == forwardport;
|
||||
});
|
||||
}
|
||||
|
||||
showDetails = (item: PortForwardItem) => {
|
||||
navigation.push(portForwardsURL({
|
||||
params: {
|
||||
forwardport: item.getForwardPort(),
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
hideDetails = () => {
|
||||
navigation.push(portForwardsURL());
|
||||
};
|
||||
|
||||
renderRemoveDialogMessage(selectedItems: PortForwardItem[]) {
|
||||
const forwardPorts = selectedItems.map(item => item.getForwardPort()).join(", ");
|
||||
|
||||
@ -123,12 +96,6 @@ export class PortForwards extends React.Component<Props> {
|
||||
customizeRemoveDialog={selectedItems => ({
|
||||
message: this.renderRemoveDialogMessage(selectedItems)
|
||||
})}
|
||||
detailsItem={this.selectedPortForward}
|
||||
onDetails={this.showDetails}
|
||||
/>
|
||||
<PortForwardDetails
|
||||
portForward={this.selectedPortForward}
|
||||
hideDetails={this.hideDetails}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -136,11 +136,11 @@ export async function addPortForward(portForward: ForwardedPort): Promise<number
|
||||
try {
|
||||
response = await apiBase.post<PortForwardResult>(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {});
|
||||
|
||||
if (response?.port != +portForward.forwardPort) {
|
||||
logger.info(`specified ${portForward.forwardPort} got ${response.port}`);
|
||||
if (response?.port && response.port != +portForward.forwardPort) {
|
||||
logger.warn(`specified ${portForward.forwardPort} got ${response.port}`);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.warn(error); // don't care, caller must check
|
||||
}
|
||||
portForwardStore.reset();
|
||||
|
||||
@ -153,7 +153,7 @@ export async function getPortForward(portForward: ForwardedPort): Promise<number
|
||||
try {
|
||||
response = await apiBase.get<PortForwardResult>(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.warn(error); // don't care, caller must check
|
||||
}
|
||||
|
||||
return response?.port;
|
||||
@ -167,7 +167,7 @@ export async function modifyPortForward(portForward: ForwardedPort, desiredPort:
|
||||
portForward.forwardPort = desiredPort.toString();
|
||||
port = await addPortForward(portForward);
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.warn(error); // don't care, caller must check
|
||||
}
|
||||
portForwardStore.reset();
|
||||
|
||||
@ -180,7 +180,7 @@ export async function removePortForward(portForward: ForwardedPort) {
|
||||
await apiBase.del(`/pods/${portForward.namespace}/${portForward.kind}/${portForward.name}/port-forward/${portForward.port}/${portForward.forwardPort}`, {});
|
||||
await waitUntilFree(+portForward.forwardPort, 200, 1000);
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.warn(error); // don't care, caller must check
|
||||
}
|
||||
portForwardStore.reset();
|
||||
}
|
||||
@ -191,7 +191,7 @@ export async function getPortForwards(): Promise<ForwardedPort[]> {
|
||||
|
||||
return response.portForwards;
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.warn(error); // don't care, caller must check
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user